Home >Database >Mysql Tutorial >MySQL GRANT命令执行时发生root权限错误问题_MySQL

MySQL GRANT命令执行时发生root权限错误问题_MySQL

WBOY
WBOYOriginal
2016-06-01 13:42:221339browse

bitsCN.com
MySQL GRANT命令执行时发生root权限错误 在MySQL节点执行GRANT命令为SPIDER服务器进行授权时,发生了如下错误: 
 引用mysql> GRANT ALL ON *.* TO 'spider'@'spiderdb' IDENTIFIED BY 'spider'; ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)   可是我就是使用root用户登录的,root的password也是空的,怎么可能会发生这个错误呢。  网上有相同的错误,是登录不进MySQL的解决办法。如果是忘记了密码,可以用下边的方法: 引用# /etc/init.d/mysql stop # mysqld_safe -u mysql --skip-grant-tables --skip-networking & # mysql -u mysql mysql> UPDATE user SET Password=PASSWORD('newpassword')where USER='root'; mysql> FLUSH PRIVILEGES; mysql> exit     # /etc/init.d/mysqld restart # mysql -uroot -pnewpassword    可是这个方法却解决不了我的问题。  网上还有一种办法,删除user.user中值为NULL的(delete from user where user is NULL),或更新NULL为test(update user set user=‘test‘ where user is NULL)。但是也不好使。  偶然发现对于单个DB的授权是没有问题的,难道是root没有特定DB的权限?写了个script对于每个database执行"GRANT ALL ON $DATABASE.* TO 'root'@'localhost' IDENTIFIED BY 'cps-pt' with grant option;",居然是information_schema的时候出错了。  前两天同志执行dump/restore的时候,DB曾经死掉过,难道information_schema被破坏掉了。 这好像是MySQL的一个restore时的bug。    作者 秦朝古月 bitsCN.com

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn