转自:https://www.cnblogs.com/huangxinyuan650/p/6360464.html
亲测可用
1 wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
2 rpm -ivh mysql-community-release-el7-5.noarch.rpm
3 sudo yum install mysql-server
4 service mysql restart
5 修改密码
use mysql;
update user set password=password('new password') where user='root'; ---这里我的密码是new password 修改成自己的就行
flush privileges;
远程连接报错处理:
错误代码是1130,ERROR 1130: Host xxx.xxx.xxx.xxx is not allowed to connect to this MySQL server 是无法给远程连接的用户权限问题
给用户授权
我用的用户是root 密码new password
首选语法为:
Sql代码
GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;
示例:
Sql代码
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'new password' WITH GRANT OPTION;
执行完后,再
mysql:flush privileges;
刷新一下权限就可以了,不用重启
亲测可用