mysql 5.7.16 远程连接

1登录到mysql中,为root进行远程访问的授权,所以主机都可以链接

GRANT ALL PRIVILEGES ON . TO 'root'@'%'IDENTIFIED BY 'mypassword' WITH GRANT OPTION;

修改生效
mysql>FLUSH PRIVILEGES

切换到 mysql DB
mysql> use mysql;

Database changed

查看现有用户,密码及允许连接的主机
mysql> select user,host from user;
+------------------+-----------+
| user | host |
+------------------+-----------+
| root | % |
| debian-sys-maint | localhost |
| mysql.sys | localhost |
| root | localhost |
+------------------+-----------+

2、进入/etc/mysql/mysql.conf.d 目录下的 mysqld.cnf 文件中需要把下面以上注释掉,使所以主机都可以链接
bind-address = 127.0.0.1

posted @ 2016-12-26 22:20  且如歌  阅读(...)  评论(...编辑  收藏
TOP