最近网站更换服务器,于是就连带的升级了MySQL8,当一切都配置好后,需要用Navicat访问数据库了,按照之前的步骤操作,突然给报了错误 (之前操作的链接:
https://www.viphper.com/1420.html)
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 'IDENTIFIED BY "password" WITH GRANT OPTION' at line 1
经过一番努力查找,原来是mysql8不在使用之前的写法了,之前一步的写法需要改为两步。
创建账户:create user ‘用户名’@’访问主机’ identified by ‘密码’;
权限修改:grant 权限列表 on 数据库 to ‘用户名’@’访问主机’ ;(修改权限时在后面加with grant option)
create user 'root'@'%' identified by 'password'; #password改成你自己的密码
grant ALL PRIVILEGES on *.* to 'root'@'%' ;
这样按照正常的流程操作即可,可以查看我之前的文章,链接在上方。