mysql開啓遠程訪問權限

 1. 
//登陸數據庫
  mysql -u root -pvmwaremysql>use mysql;
  //%爲全部ip均可以遠程訪問
  mysql>update user set host = '%' where user = 'root';
//或直接添加一條語句也行   
mysql>insert into user (host,user,password) values('192.168.0.51','root',password('123'));  
  //查看一下修改
  mysql>select host, user from user;
//推送設置到內存或重啓服務器也行
  mysql>FLUSH PRIVILEGES

2.  
GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%'IDENTIFIED BY 'mypassword' WITH GRANT OPTION;
若是是固定ip就這麼寫
grant all privileges on *.* to 'root'@'192.168.0.49'identified by '123' with grant option;
//推送設置到內存或重啓服務器也行  mysql>FLUSH PRIVILEGES 
相關文章
相關標籤/搜索