Ubuntu下如何开启Mysql远程访问

2018-01-17  本文已影响0人  陌北v1

Ubuntu14.04在目录/etc/mysql下找到my.cnf,用vim编辑,找到my.cnf里面的
bind-address = 127.0.0.1
将其注释。

ubuntu16.04打开/etc/mysql/mysql.conf.d/mysqld.cnf这个文件里面有一个
bind-address = 127.0.0.1 ->将其注释掉

1.登录:mysql -uroot -p

  1. 然后在mysql>这里输入:grant all on . to username@'%' identified by 'password;
    注意:username是用户名,password是要自己填写的一个名字,例如:
    grant all on . to root@'%' identified by '123456';

3.刷新刚才的内容。执行:flush privileges;

上一篇 下一篇

猜你喜欢

热点阅读