centos7 安装 mysql5.7
-
下载rpm包
wget https://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm
-
对repo进行安装
rpm -ivh mysql57-community-release-el7-9.noarch.rpm
-
进入
/etc/yum.repos.d
目录 -
查看是否有
mysql-community.repo
和mysql-community-source.repo
文件 -
安装
yum install mysql-server -y
-
启动
systemctl start mysqld
-
查看是否启动
ps aux | grep mysql
-
生成临时密码
grep 'temporary password' /var/log/mysqld.log
2020-03-20T02:17:41.344655Z 1 [Note] A temporary password is generated for root@localhost: vSX&3(gEyt:w
-
进入mysql
mysql -uroot -p 然后回车,输入上面提供的临时密码
-
报警告信息
You must reset your password using ALTER USER statement before executing this statement.
-
如何排除警告信息
MySQL版本5.7.6版本以前用户可以使用如下命令: mysql> SET PASSWORD = PASSWORD('你自己设置的密码'); MySQL版本5.7.6版本开始的用户可以使用如下命令: mysql> ALTER USER USER() IDENTIFIED BY '你自己设置的密码';
-
如果出现
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
set global validate_password_policy=0;
-
关闭服务
systemctl stop mysqld
-
启动服务
systemctl start mysqld
-
登录你的mysql
mysql -uroot -p你设置的密码
-
至此 你的mysql5.7的版本搭建完成