MySQL 登入資料庫報錯'ERROR 1045 (28000): Access denied for user'..'@'localhost''
登入資料庫時報錯
[root@localhost install]# mysql -uzabbix -p
Enter password:
ERROR 1045 (28000): Access denied for user 'zabbix'@'localhost' (using password: YES)
檢視資料庫中的使用者
[root@localhost install]# mysql -uroot -p
mysql> select host,user from mysql.user;
+-----------------------+--------+
| host | user |
+-----------------------+--------+
| % | zabbix |
| 127.0.0.1 | root |
| localhost | |
| localhost | root |
| localhost.localdomain | |
| localhost.localdomain | root |
+-----------------------+--------+
6 rows in set (0.00 sec)
[root@localhost install]# mysql -uzabbix -p
Enter password:
ERROR 1045 (28000): Access denied for user 'zabbix'@'localhost' (using password: YES)
[root@localhost install]# mysql -uroot -p
mysql> select host,user from mysql.user;
+-----------------------+--------+
| host | user |
+-----------------------+--------+
| % | zabbix |
| 127.0.0.1 | root |
| localhost | |
| localhost | root |
| localhost.localdomain | |
| localhost.localdomain | root |
+-----------------------+--------+
6 rows in set (0.00 sec)
報錯原因:
在user授權表中,zabbix使用者被賦予了在所有主機登入的許可權,但是沒有在localhost的登入許可權;在MySQL中,localhost的登入需要使用socket的方式,而其他的登入則使用-h指定IP或主機名的方式
解決方法:
使用-h透過IP登入即可
[root@localhost install]# mysql -h 10.10.10.10 -uzabbix -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 5.1.73 Source distribution
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> select user();
+--------------------+
| user() |
+--------------------+
| zabbix@10.10.10.10 |
+--------------------+
1 row in set (0.00 sec)
解決方法:
使用-h透過IP登入即可
[root@localhost install]# mysql -h 10.10.10.10 -uzabbix -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 5.1.73 Source distribution
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> select user();
+--------------------+
| user() |
+--------------------+
| zabbix@10.10.10.10 |
+--------------------+
1 row in set (0.00 sec)
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26506993/viewspace-2134697/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Mysql:ERROR 1045 (28000): Access denied for user 'root'@'localhost'MySqlErrorlocalhost
- ERROR 1045 (28000): Access denied for user 'root'@'localhost'Errorlocalhost
- Error 1045(28000) Access Denied for user 'root'@'localhost'Errorlocalhost
- 報錯”ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: NO)”Errorlocalhost
- 解決Mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost'MySqlErrorlocalhost
- ERROR 1045 (28000): Access denied for userError
- 登入mysql報ERROR 1045 (28000): Access denied 解決方法MySqlError
- ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password:YES)Errorlocalhost
- mysql ERROR 1045 (28000): Access denied for user解決方法MySqlError
- Linux錯誤 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)LinuxErrorlocalhost
- rhel4 mysql5.1登陸ERROR 1045 (28000): Access denied for userMySqlError
- MySQL 8.0.13 密碼問題 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)MySql密碼Errorlocalhost
- linux安裝MySQL出現ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)LinuxMySqlErrorlocalhost
- ERROR 1045: Access denied for user: 'root@localhost' (Using password: NO)Errorlocalhost
- Mysql 5.5 原始碼安裝後建立使用者報錯"ERROR 1045 (28000): Access denied for user"MySql原始碼Error
- mysql 1045, "Access denied for user 'root'@'localhost' (using password: NO)"MySqllocalhost
- Ubuntu18.04:mysql:ERROR 1698 (28000): Access denied for user ‘root‘@‘localhost‘UbuntuMySqlErrorlocalhost
- #1045 - Access denied for user 'root'@'localhost' (using password: NO)localhost
- ERROR 1045 (28000): Access denied for user 'root'@'127.0.0.1' (using password: YES)Error127.0.0.1
- 【MySQL】---1045-Access denied for user 'root'@'localhost'(using password :YES)MySqllocalhost
- mysql登入報錯提示:ERROR 1045 (28000)的解決方法MySqlError
- MySQL使用普通使用者訪問返回ERROR 1698 (28000): Access denied for user 'root'@'localhost'MySqlErrorlocalhost
- 一看便知linux下mysql報錯ERROR 1044: Access denied for user: '@localhost' to database 'mysql'LinuxMySqlErrorlocalhostDatabase
- MYSQL解決error: 'Access denied for user 'root'@'localhost' (using password:MySqlErrorlocalhost
- vue專案中連線MySQL時,報錯ER_ACCESS_DENIED_ERROR: Access denied for user 'root'@'localhost' (using password:YES)VueMySqlErrorlocalhost
- ubuntu mysql Access denied for user root@localhostUbuntuMySqllocalhost
- 解決mysql“Access denied for user 'root'@'localhost'”MySqllocalhost
- Mysql資料庫報ERROR 1045 (28000)報錯及MySQL忘記密碼找回MySql資料庫Error密碼
- ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'mysql'ErrorlocalhostDatabaseMySql
- ERROR 1045 (28000): ProxySQL Error: 報錯ErrorSQL
- 啟動報錯:Access denied for user 'root'@'localhost' (using password:YES)localhost
- 關於mysql登入出現報錯資訊:ERROR1045(28000)的解決方法MySqlError
- Mysql 5.7 CentOS Access denied for user 'root'@'localhost'解決方式MySqlCentOSlocalhost
- 解決mysql"Access denied fot user 'root'@'localhost'"問題MySqllocalhost
- Access denied for user 'root'@'localhost' (using password: NO)localhost
- Access denied for user 'default'@'%' to database 'shop'報錯Database
- MySQL系列:Docker安裝 MySQL提示錯誤:Access denied for user'root'@'localhost' (using password:yes)MySqlDockerlocalhost
- Access denied for user ‘root‘@‘localhost‘問題的解決localhost