Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

开启mysql的远程访问 两种方式

  • 方式1
grant all privileges on *.* to 'root'@'192.168.1.145' identified by '123456' with grant option;
flush privileges;
  • 方式2
use mysql;
update user set host = '%' where user = 'root';

更细权限之后,一定要刷新一下,否则不会生效

flush privileges;
  • 方式3
  此处为设置root用户远程
  mysql -uroot -p  #输入密码

  use mysql;

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

  select host, user from user;

  flush privileges;

去掉配置文件中bind-address

bind-address          = 127.0.0.1
# bind-address          = 127.0.0.1