1.
//登錄數(shù)據(jù)庫
mysql -u root -pvmwaremysql>use mysql;
//%為所有ip都可以遠(yuǎn)程訪問
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;
//推送設(shè)置到內(nèi)存
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;
//推送設(shè)置到內(nèi)存
mysql>FLUSH PRIVILEGES