久久精品人人爽,华人av在线,亚洲性视频网站,欧美专区一二三

mysql出現1045錯誤怎么辦

155次閱讀
沒有評論

共計 3283 個字符,預計需要花費 9 分鐘才能閱讀完成。

這篇文章給大家分享的是有關 mysql 出現 1045 錯誤怎么辦的內容。丸趣 TV 小編覺得挺實用的,因此分享給大家做個參考,一起跟隨丸趣 TV 小編過來看看吧。

–mysql5.6,安裝好后進行登錄出現
[root@mytest_db usr]# mysql -uroot -p
Enter password:
ERROR 1045 (28000): Access denied for user root @ localhost (using password: NO)

提示密碼問題,再用命令修改,也會出現以下錯誤
[root@mytest_db usr]# mysqladmin -u root password petrel
mysqladmin: connect to server at localhost failed
error: Access denied for user root @ localhost (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 root@ localhost   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)

感謝各位的閱讀!關于“mysql 出現 1045 錯誤怎么辦”這篇文章就分享到這里了,希望以上內容可以對大家有一定的幫助,讓大家可以學到更多知識,如果覺得文章不錯,可以把它分享出去讓更多的人看到吧!

正文完
 
丸趣
版權聲明:本站原創文章,由 丸趣 2023-07-26發表,共計3283字。
轉載說明:除特殊說明外本站除技術相關以外文章皆由網絡搜集發布,轉載請注明出處。
評論(沒有評論)
主站蜘蛛池模板: 金坛市| 潼南县| 嘉祥县| 泗洪县| 青岛市| 雷山县| 清丰县| 长宁县| 揭阳市| 东乡| 大足县| 肥西县| 黔西县| 娄底市| 区。| 衡阳市| 旅游| 城市| 淮南市| 百色市| 楚雄市| 遵化市| 芜湖县| 竹山县| 青川县| 武山县| 会宁县| 同仁县| 旅游| 织金县| 洛隆县| 洛扎县| 博罗县| 葫芦岛市| 增城市| 阳曲县| 佛坪县| 南川市| 高阳县| 澄江县| 汾阳市|