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/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 報錯”ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: NO)”Errorlocalhost
- ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password:YES)Errorlocalhost
- Linux錯誤 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)LinuxErrorlocalhost
- 解決Mysql:ERROR 1045 (28000):Access denied for user ‘root‘@‘localhost‘ (using password: NO)的方法MySqlErrorlocalhost
- MySQL 8.0.13 密碼問題 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)MySql密碼Errorlocalhost
- Ubuntu18.04:mysql:ERROR 1698 (28000): Access denied for user ‘root‘@‘localhost‘UbuntuMySqlErrorlocalhost
- mysql 1045, "Access denied for user 'root'@'localhost' (using password: NO)"MySqllocalhost
- MySQL使用普通使用者訪問返回ERROR 1698 (28000): Access denied for user 'root'@'localhost'MySqlErrorlocalhost
- mysql登入報錯提示:ERROR 1045 (28000)的解決方法MySqlError
- vue專案中連線MySQL時,報錯ER_ACCESS_DENIED_ERROR: Access denied for user 'root'@'localhost' (using password:YES)VueMySqlErrorlocalhost
- Mysql資料庫報ERROR 1045 (28000)報錯及MySQL忘記密碼找回MySql資料庫Error密碼
- ERROR 1045 (28000): ProxySQL Error: 報錯ErrorSQL
- ubuntu mysql Access denied for user root@localhostUbuntuMySqllocalhost
- 啟動報錯:Access denied for user 'root'@'localhost' (using password:YES)localhost
- MySQL系列:Docker安裝 MySQL提示錯誤:Access denied for user'root'@'localhost' (using password:yes)MySqlDockerlocalhost
- Access denied for user 'default'@'%' to database 'shop'報錯Database
- SQLSTATE[HY000] [1045] Access denied for user ‘root‘@‘localhost‘ (using password: YES)”錯誤的隱藏解決辦法SQLlocalhost
- Access denied for user ‘root‘@‘localhost‘問題的解決localhost
- Navicat遠端連線MySQL 提示1045 - Access denied for user 'root'@'223.74.158.192'(using password:YES)MySql
- 使用Mysql登入時,ERREORE 1045(28000) 解決方法MySql
- java.sql.SQLException: Access denied for user ‘root‘@‘localhost‘ (using password: YES)JavaSQLExceptionlocalhost
- load data infile ERROR 1045 (28000)Error
- laravel mysql批量提交報Access denied 錯誤LaravelMySql
- mac os x 安裝mysql遇到 Access denied for user ‘root‘@‘localhost‘ (using password: YES)的解決方法MacMySqllocalhost
- SpringBoot中yml配置java.sql.SQLException: Access denied for user ‘root‘@‘localhost‘ (using password: NOSpring BootJavaSQLExceptionlocalhost
- mysql登入遇到ERROR 1045問題解決方法MySqlError
- hive建立分割槽表報錯AccessControlException Permission denied: user=NONE, access=WRITE, inodeHiveExceptionNone
- 【本人親測 已解決】044 - Access denied for user ‘root‘@‘%‘ to database ‘資料庫名稱‘Database資料庫
- Permission denied:user=xxx,access=WRITE,inode=xxx
- OGG Director連線報錯Access denied
- 網站程式呼叫資料庫時提示“command denied to user”網站資料庫
- nginx中報Access denied.Nginx
- mysql報1045錯誤是什麼意思MySql
- Mysql資料庫使用Navicat Mysql匯入sql檔案報錯MySql資料庫
- Access 匯入 oracle 資料庫Oracle資料庫
- CAS 5.3使用MySQL資料庫登入MySql資料庫
- Laravel5.4 資料庫遷移錯誤 SQLSTATE [42000] Syntax error or access violation 1071Laravel資料庫SQLError
- sqlplus登入資料庫報錯ORA-12547: TNS:lost contactSQL資料庫
- 【ERROR】su user報'This account is currently not available'錯誤 for linuxErrorAILinux