centos 7 安装mysql

1. 下载rpm包

wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm

 

2. 安装rpm包到本地

yum -y localinstall mysql57-community-release-el7-11.noarch.rpm 

 

3. 安装 mysql

yum -y install mysql-community-server

 

4. 启动mysql

systemctl start mysqld

 

5.获取初始密码

grep 'temporary password' /var/log/mysqld.log

 

6. 首次登陆(此处的密码在上一条命令的结果中)

mysql -u root -p94Y_ZQBtIjxq

 

7. 修改初始化密码(如果报错,就是语法错误或者是密码太简单了)

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'Password_123';

 

8. 设置远程登陆

mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'Password_123' WITH GRANT OPTION;

 

9. 安装完毕

mysql> flush privileges;

 

posted @ 2019-05-13 10:53  嘿!小伙不错  阅读(207)  评论(0编辑  收藏  举报