# 下载mysql rpm 源
wget http://repo.mysql.com/mysql80-community-release-el7-6.noarch.rpm
# 安装源
sudo rpm -ivh mysql80-community-release-el7-6.noarch.rpm
# 安装mysql
sudo yum install mysql-server --nogpgcheck -y
# 启动服务
service mysql start
# 查看初始密码
cat /var/log/mysqld.log | grep pass
# 登陆
mysql -uroot -p
# 修改密码
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';
# 修改远程访问
mysql> use mysql
mysql> update user set host='%' where user ='root';
# 刷新权限
mysql> FLUSH PRIVILEGES;
网友评论