mysql報關於使用者密碼1045(28000),幾種處理方法
--mysql5.6,安裝好後進行登入出現
[root@mytest_db usr]# mysql -uroot -p
Enter password:
ERROR 1045 (28000): Access denied for user (using password: NO)
提示密碼問題,再用命令修改,也會出現以下錯誤
[root@mytest_db usr]# mysqladmin -u root password 'petrel'
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user (using password: NO)'
這個時候需要用這種方法進行處理
--重啟mysql服務,採用mysqld_safe的方式進行
[root@mytest_db usr]# service mysql stop
Shutting down MySQL...[ OK ]
[root@mytest_db usr]# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
[1] 5043
啟動後,就可以直接不用密碼直接進入了,這個時候重新設定密碼
[root@mytest_db usr]# mysql -uroot
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.19 MySQL Community Server (GPL)
Copyright (c) 2000, 2014, 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> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> update user set Password=PASSWORD('petrel') where user = 'root';
Query OK, 4 rows affected (0.00 sec)
Rows matched: 4 Changed: 4 Warnings: 0
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> quit
Bye
[root@mytest_db usr]# service mysql restart
這個時候,再進行登入就沒問題了
[root@mytest_db data]# mysql -uroot -ppetrel
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.6.19
Copyright (c) 2000, 2014, 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> use mysql;
ERROR 1820 (HY000): You must SET PASSWORD before executing this statement
mysql> grant all privileges on *.* to identified by 'petrel';
ERROR 1820 (HY000): You must SET PASSWORD before executing this statement
mysql> set PASSWORD=PASSWORD('petrel');
Query OK, 0 rows affected (0.00 sec)
--出現mysql.user表裡面使用者為空時出現
ERROR 1045 (28000): Access denied for user
這個時候可以進行如下處理
刪除這些為空的使用者或者更新為其他使用者名稱
刪除user.user中值為NULL的,或更新NULL為其它值等
mysql> delete from user where user is NULL
Query OK, 1 rows affected (0.00 sec)
或者更新為其它值
mysql> update user set user='mytest' where user is NULL
Query OK, 1 rows affected (0.00 sec)
--如果mysql.user表裡面沒有可以訪問的使用者,也會出現
MYSQL ERROR 1045 (28000): Access denied for user (using password: YES)
這個時候,我們就要採用如下步驟進行
[root@mytest_db usr]# service mysql stop
Shutting down MySQL...[ OK ]
[root@mytest_db usr]# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
[root@mytest_db usr]# mysql -uroot
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.19 MySQL Community Server (GPL)
Copyright (c) 2000, 2014, 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 * from user;
發現沒有使用者
mysql> INSERT INTO user(host, user, password, select_priv, insert_priv, update_priv) VALUES ('localhost', 'username', PASSWORD(‘yourpassword'), 'Y', 'Y','Y');
Query OK, 1 row affected, 3 warnings (0.00 sec)
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29371470/viewspace-1409075/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Mysql資料庫報ERROR 1045 (28000)報錯及MySQL忘記密碼找回MySql資料庫Error密碼
- 關於mysql登入出現報錯資訊:ERROR1045(28000)的解決方法MySqlError
- 登入mysql報ERROR 1045 (28000): Access denied 解決方法MySqlError
- PHP處理密碼的幾種方式PHP密碼
- mysql登入報錯提示:ERROR 1045 (28000)的解決方法MySqlError
- MySQL修改root密碼的幾種方法MySql密碼
- Mysql 5.5 原始碼安裝後建立使用者報錯"ERROR 1045 (28000): Access denied for user"MySql原始碼Error
- mysql ERROR 1045 (28000): Access denied for user解決方法MySqlError
- 關於Android的幾種事件處理Android事件
- 使用Mysql登入時,ERREORE 1045(28000) 解決方法MySql
- ERROR 1045 (28000): ProxySQL Error: 報錯ErrorSQL
- MySQL 8.0.13 密碼問題 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)MySql密碼Errorlocalhost
- mysql 8.0忘記root使用者密碼處理MySql密碼
- 關於root(其他)使用者拒絕登陸mysql的處理方法MySql
- Mysql:ERROR 1045 (28000): Access denied for user 'root'@'localhost'MySqlErrorlocalhost
- 各種報錯處理方法
- Oracle資料使用者密碼過期處理方法Oracle密碼
- MySQL 登入資料庫報錯'ERROR 1045 (28000): Access denied for user'..'@'localhost''MySql資料庫Errorlocalhost
- mysql忘記密碼後處理MySql密碼
- CentOS7忘記mysql的root密碼_處理方法.CentOSMySql密碼
- 忘記密碼的資料庫使用者處理方法密碼資料庫
- 修改MySQL密碼的四種方法MySql密碼
- 解決Mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost'MySqlErrorlocalhost
- 解決Mysql:ERROR 1045 (28000):Access denied for user ‘root‘@‘localhost‘ (using password: NO)的方法MySqlErrorlocalhost
- PHP生成隨機密碼的幾種方法PHP隨機密碼
- 使用者密碼過期的處理密碼
- 【Oracle】使用者密碼過期處理Oracle密碼
- ERROR 1045 (28000): Access denied for userError
- 關於MySQL下修改root使用者密碼的解決MySql密碼
- MySQL 關於毫秒的處理薦MySql
- MySQL修改root密碼的多種方法MySql密碼
- mysql root 修改密碼的多種方法MySql密碼
- MySQL5.7忘記root密碼處理MySql密碼
- MySQL忘記root密碼後的處理MySql密碼
- 關於Oracle死鎖處理方法Oracle
- load data infile ERROR 1045 (28000)Error
- ERROR 1045 (28000): using password: YESError
- 【問題處理】MySQL忘記root密碼的處理辦法MySql密碼