小工具知识网

当前位置: 首页 > 行业知识 > mysql授权失败:check the manual that corresponds to your MySQL server version for the right syntax to use

行业知识

mysql授权失败:check the manual that corresponds to your MySQL server version for the right syntax to use

2026-11-04 14:41:26 来源:互联网转载

最近新部署了一个mysql,然后进入mysql 之后授权失败,然后发现原来是数据库的版本太高导致的,下面是记录如何操作的。

首先进入mysql

# 进入到宿主机上的时候,执行登录mysql -uroot -p# 然后输入密码成功之后就可以看见mysql> mysql> mysql> 

错误授权

grant all privileges on *.* to root@'%' identified by "xxxxx";

结果执行的时候出现报错:

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 ‘xxxxx’’ at line 1

检查Mysql版本select version();

mysql> select version();+-----------+| version() |+-----------+| 8.0.26    |+-----------+1 row in set (0.00 sec)

发现版本太高了,一般大家用的都是6点多,7点几的版本较多。

解决

#创建账户create user 'root'@'172.16.10.203' identified by  'password'#赋予权限,with grant option这个选项表示该用户可以将自己拥有的权限授权给别人grant all privileges on *.* to 'root'@'172.16.10.203' with grant option#改密码&授权超用户,flush privileges 命令本质上的作用是将当前user和privilige表中的用户信息/权限设置从mysql库(MySQL数据库的内置库)中提取到内存里flush privileges;创建账户::create user ‘用户名'@‘访问主机' identified by ‘密码';赋予权限:grant 权限列表 on 数据库 to ‘用户名'@‘访问主机' ;with grant option这个选项表示该用户可以将自己拥有的权限授权给别人

原因是:此版的的mysql版本把将创建账户和赋予权限分开了。

上一篇:怎么停用googleplay服务器?

下一篇:Dedecms升级疑难解析,常见问题和错误处理指南