mysql 开通远程连接

修改root密码:

1、修改/etc/mysql/my.cnf (如果不存在,可以从/usr/local/mysql/support-files 中拷贝 my_default.cnf 过去)

[mysqld]后面任意一行添加“skip-grant-tables”用来跳过密码验证的过程

2、保存文档,退出。重启mysql服务

3、进入mysql 

4、使用下面命令:

use mysql

update user set authentication_string=password("egova2015") where user = "root";

flush privileges;

quit;

密码修改成功

5、去my.cnf去掉添加的 skip-grant-tables ,然后重启

开通远程连接:

1、mysql -u root -p

输入密码

2、use mysql

3、select host,user,authentication_string from user;

4、update user set host='%' where user = 'root';

5、grant all privileges on *.* to root@'%' identified by "password";

6、flush privileges;

原文地址:https://www.cnblogs.com/liuyanerfly/p/9436454.html