2024年4月25日 星期四
通知

Centos7.2.1511YUM安装MySQL5.7.10

//查看系统版本

shell > cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)

//下载YUM库

shell > wget http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm

//安装YUM库

shell > yum localinstall -y mysql57-community-release-el7-7.noarch.rpm

//安装数据库

shell > yum install -y mysql-community-server

//启动MySQL服务

shell > systemctl start  mysqld.service

//默认空密码

shell > mysql -uroot -p

//重置root密码

mysql > ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';

//简单快速重置ROOT数据库密码
最简单的办法,也是最笨的方法,替换mysql数据库中的三个文件

 /var/lib/mysql/mysql/   //路径
user.frm、user.MYD、user.MYI   //替换这三个文件

附几个错误提示解决办法
1、ERROR 1290 (HY000): The MySQL server is running with the –skip-grant-tables option so it cannot execute this statement.
shell> mysql
mysql> set global read_only=0;
mysql> flush privileges;
mysql> quit
shell> /usr/bin/mysql_secure_installation
2、[ERROR] InnoDB: Cannot create log files because data files are corrupt or the database was not shut down cleanly after creating the data files.
shell> cd /var/lib/mysql
shell> mv ibdata1 ibdata1.bak
3、[ERROR] InnoDB: space header page consists of zero bytes in data file ./ibdata1
innodb_flush_log_at_trx_commit = 2 在此后添加下面内容
innodb_flush_method=normal
4、ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: NO)
shell> /usr/bin/mysql_secure_installation

原创文章,转载请注明: 转载自荣耀博客
本文链接地址: Centos7.2.1511YUM安装MySQL5.7.10

关于 荣耀博客

好记性,不如烂笔头。

发表回复