rpm -Uvh https://repo.mysql.com/mysql80-community-release-el7-3.noarch.rpm
yum --enablerepo=mysql80-community install mysql-community-server
运行Mysql服务
systemctl start mysqld.service
mysql服务状态
systemctl status mysqld.service
查看默认密码
grep "password" /var/log/mysqld.lo
//登录
mysql -u root -p
修改root默认密码
ALTER USER 'root'@'localhost' IDENTIFIED BY '密码'
远程访问受限解决方法
方法一 已存在用户授权
mysql> use mysql;
## 确保下面语句执行为单一结果,结果多条增加筛选条件
mysql> select host,user from user where user='root';
mysql> update user set host='%' where user='root';
mysql> flush privileges
方法二 新建用户并授权
mysql> CREATE USER 'root'@'%' IDENTIFIED BY 'root';
## 语法模版 GRANT ALL PRIVILEGES ON 库名.表名 TO '用户名'@'IP地址' WITH GRANT OPTION
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;
mysql> FLUSH PRIVILEGES;