如果想要用户root可以远程登录,则可通过修改user表中root用户对应的host字段值为“%”即可。我们用以下语句进行修改:
update user set host = '%' where user = 'root';
或者:
GRANT ALL PRIVILEGES ON *.* TO '登录id'@'%' IDENTIFIED BY '登录密码' WITH GRANT OPTION;
如果要让root对所有数据库操作权限,还需给root用户进行授权:
grant all privileges on *.* to root@'%' identified by "123456";