1. 登录数据库:
mysql -u root -p
mysql>use mysql;
2. 查看mysql权限:
select host, user from user;
3. 赋予任何主机访问数据的权限
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
如果是固定ip就这么写:
grant all privileges on *.* to 'root'@'192.168.0.49' identified by 'password' with grant option;
mysql>FLUSH PRIVILEGES