ERROR 1045 (28000): Access denied for user 'root'@'localh_MySQL

WBOY
Lepaskan: 2016-06-01 13:32:19
asal
1260 orang telah melayarinya

bitsCN.com

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)解决

 

朋友问我问题:

m三ysql 升级了 5.0 -- 5.5导入的数据没问题, grant all privileges on *.* to test@'12.12.12.12';报错ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

我刚开始怀疑密码不对,让他换成grant all privileges on *.* to test@'12.12.12.12' identified by 'xxx'; 也不行

再换成grant all privileges on *.* to test@'12.12.12.12' identified by '';也不行

 

mysql> grant all privileges on *.* to test@'12.12.12.12' identified by '';ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)但是执行如下命令成功了mysql> grant select on *.* to test@'12.12.12.12' identified by '';Query OK, 0 rows affected (0.01 sec)
Salin selepas log masuk

我怀疑当前的root帐号权限问题,让他执行show grants;

[sql] mysql> show grants;  +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+  | Grants for root@localhost                                                                                                                                                                                                                                                                                                                                     |  +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+  | GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER ON *.* TO 'root'@'localhost' WITH GRANT OPTION |  | GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES ON `mysql`.* TO 'root'@'localhost'                                                                                                                                                                                                         |  | GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION                                                                                                                                                                                                                                                                                                  |  +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+  3 rows in set (0.00 sec)  果然问题出来了,因为正常的root帐号权限如下:[html] mysql> show grants;  +---------------------------------------------------------------------+  | Grants for root@localhost                                           |  +---------------------------------------------------------------------+  | GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION |  | GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION        |  +---------------------------------------------------------------------+  2 rows in set (0.00 sec)    mysql>   
Salin selepas log masuk

他的root帐号没有all privileges,所以分配别人all的时候就会报错。

我让他用mysqladmin重置root帐号试试看

/usr/local/mysql/bin/mysqladmin –u root password ‘’;
Salin selepas log masuk

 

 

bitsCN.com
Label berkaitan:
sumber:php.cn
Kenyataan Laman Web ini
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn
Tutorial Popular
Lagi>
Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan
Tentang kita Penafian Sitemap
Laman web PHP Cina:Latihan PHP dalam talian kebajikan awam,Bantu pelajar PHP berkembang dengan cepat!