目录
[TOC]
问题
执行grant all on . to root@’%’ identified by ‘password’ with grant option;
时报错:ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'mysql> grant all on *.* to root@'%' identified by
,因为这是旧版mysql的语法
解决方法
use mysql;
新版需要先创建用户再授权
create USER 'root用户名'@'%' IDENTIFIED BY 'root密码';
# 将要修改的用户权限改为%
update user set host = '%' where user ='root';
# 刷新权限
flush privileges;
其中%
表示允许所有ip以root
身份访问mysql
之后就可以用第三方软件访问数据库了