1、授权
mysql>grant all privileges on *.* to 'root'@'%' identified by 'password' with grant option
mysql>flush privileges
mysql的用户都有host限制的一般是%或localhost,如果这个用户是localhost时只可以在本地登陆,改成%就不受限制了
1、你得先搞清楚192.168.1.200到底是要访问localhost还是其他ip的mysql2、mysql检查访问主机
mysql -uroot -p -Dmysql -e"select user,host from user"
3、修改当前用户允许远程访问
例如:
UPDATE user SET host = '%' WHERE user = ‘root’ and host='localhost'
4、创建可以远程访问的用户
CREATE USER 'user01'@'%' IDENTIFIED BY '123456'
GRANT ALL ON db01.* TO 'user01'@'%'
5、创建只允许192.168.1.200访问的用户
CREATE USER 'user02'@'192.168.1.200' IDENTIFIED BY '123456'
GRANT ALL ON db02.* TO 'user02'@'192.168.1.200'
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)