MYSQL8.0.13赋予用户权限的问题

给用户赋权限

You are not allowed to create a user with GRANT

当执行grant all privileges ON . to ‘root’@’%'命令给用户赋权限时,一般5.0开头的版本都不会报错,而8.0以上的无论是否有无当前用户,都需要新建一下,执行create user ‘root‘ identified by ’密码‘,之后再执行上述命令及可成功。

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

执行grant all privileges ON . to ‘root’@’%’ IDENTIFIED by '密码’命令时,如报上述错误,则是因为MySQL8.0以上版本做了修改,已经不需要identified by ’密码‘,直接将其去掉就可以了

The user specified as a definer (‘root’@’%’) does not exist

代码中若出现此错误,则是因为root用户没有权限,需要执行一下命令给用户赋权限,grant all privileges ON . to ‘root’@’%’ IDENTIFIED by ‘密码’

你可能感兴趣的:(MySQL)