1.下载mysql源安装包
1 | wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm |
2.安装mysql源
1 | yum localinstall mysql57-community-release-el7-8.noarch.rpm |
3.检查mysql源是否安装成功
1 | yum repolist enabled | grep "mysql.*-community.*" |
5.安装MySQL
1 | yum install mysql-community-server |
6.启动MySQL服务
1 | systemctl start mysqld |
7.开机启动
1 | systemctl enable mysqld |
8.修改root本地登录密码
1)查看mysql密码
1 | shell> grep 'temporary password' /var/log/mysqld.log |
2)连接mysql
1 | shell> mysql -uroot -p |
3)修改密码[注意:后面的分号一定要跟上]
1 | mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!'; |
或者:
1 | mysql> set password for 'root'@'localhost'=password('MyNewPass4!'); |
9.添加远程登录用户
1 | grant all privileges on *.* to root@'%' identified by "密码"; |
更新1
flush privileges;
最后退出搞定!
1 | exit |