1.安装rpm源
rpm -Uvh http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm
2.安装 MySQL
yum install -y mysql-community-server mysql-community-devel
3.MySQ和设置自启动
systemctl start mysqld
systemctl enable mysqld
4.获取mysql初始密码:
grep 'temporary password' /var/log/mysqld.log
OmQAWGk0)q为mysql的root登录密码
5.修改mysql的root密码
mysql -uroot -p
ALTER USER 'root'@'localhost' IDENTIFIED BY 'P@ssw0rd';
FLUSH PRIVILEGES;
6.重启mysql
stystemctl restart mysqld
7.测试登录mysql
8.设置mysql允许任意ip远程root登录到服务器
GRANT ALL PRIVILEGES ON . TO 'root'@'%' IDENTIFIED BY 'P@ssw0rd' WITH GRANT OPTION;
FLUSH PRIVILEGES;
9.Navicat测试远程登录mysql服务器