Mysql:ERROR 1045 (28000): Access denied for user 'root'@'localhost'
1、登陸mysql時報如下錯誤:
C:\Users\Administrator>mysql -uroot -p
Enter password: ******
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
2、停止mysql服務
net stop mysql5----由於服務名是mysql5
3、修改my.ini檔案
在安裝路徑下找到my.ini檔案,我的是E:\Program Files\MySQL\MySQL Server 5.0
在【mysqld】下面新增一行:skip_grant_tables---跳過密碼驗證
4、登陸資料庫修改密碼
E:\Program Files\MySQL\MySQL Server 5.0\bin>mysql -uroot -p
Enter password: ----這裡可以直接敲回車
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.0.96-community-nt MySQL Community Edition (GPL)
Copyright (c) 2000, 2011, 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> update user set password=password('mysql') where user='root';
ERROR 1046 (3D000): No database selected
mysql> use mysql -----這裡要選擇mysql資料庫
Database changed
mysql> update user set password=password('mysql') where user='root'; ----修改root使用者密碼
Query OK, 1 row affected (0.02 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> quit
Bye
E:\Program Files\MySQL\MySQL Server 5.0\bin>mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.0.96-community-nt MySQL Community Edition (GPL)
Copyright (c) 2000, 2011, 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> update user set password=password('mysql') where user='root';
ERROR 1046 (3D000): No database selected
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> quit
Bye
5、將my.ini中的skip_grant_tables刪除
6、重啟mysql5服務
C:\Users\Administrator>net start mysql5
MySQL5 服務正在啟動 .
MySQL5 服務已經啟動成功。
7、登陸資料庫
C:\Users\Administrator>mysql -uroot -p
Enter password: ***** ----輸入剛剛設定的密碼
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.0.96-community-nt MySQL Community Edition (GPL)
Copyright (c) 2000, 2011, 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> show databases; ----檢視當前有哪些資料庫
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| test |
+--------------------+
3 rows in set (0.00 sec)
C:\Users\Administrator>mysql -uroot -p
Enter password: ******
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
2、停止mysql服務
net stop mysql5----由於服務名是mysql5
3、修改my.ini檔案
在安裝路徑下找到my.ini檔案,我的是E:\Program Files\MySQL\MySQL Server 5.0
在【mysqld】下面新增一行:skip_grant_tables---跳過密碼驗證
4、登陸資料庫修改密碼
E:\Program Files\MySQL\MySQL Server 5.0\bin>mysql -uroot -p
Enter password: ----這裡可以直接敲回車
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.0.96-community-nt MySQL Community Edition (GPL)
Copyright (c) 2000, 2011, 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> update user set password=password('mysql') where user='root';
ERROR 1046 (3D000): No database selected
mysql> use mysql -----這裡要選擇mysql資料庫
Database changed
mysql> update user set password=password('mysql') where user='root'; ----修改root使用者密碼
Query OK, 1 row affected (0.02 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> quit
Bye
E:\Program Files\MySQL\MySQL Server 5.0\bin>mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.0.96-community-nt MySQL Community Edition (GPL)
Copyright (c) 2000, 2011, 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> update user set password=password('mysql') where user='root';
ERROR 1046 (3D000): No database selected
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> quit
Bye
5、將my.ini中的skip_grant_tables刪除
6、重啟mysql5服務
C:\Users\Administrator>net start mysql5
MySQL5 服務正在啟動 .
MySQL5 服務已經啟動成功。
7、登陸資料庫
C:\Users\Administrator>mysql -uroot -p
Enter password: ***** ----輸入剛剛設定的密碼
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.0.96-community-nt MySQL Community Edition (GPL)
Copyright (c) 2000, 2011, 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> show databases; ----檢視當前有哪些資料庫
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| test |
+--------------------+
3 rows in set (0.00 sec)
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/10271187/viewspace-1651544/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- ERROR 1045 (28000): Access denied for user 'root'@'localhost'Errorlocalhost
- Error 1045(28000) Access Denied for user 'root'@'localhost'Errorlocalhost
- 解決Mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost'MySqlErrorlocalhost
- ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password:YES)Errorlocalhost
- 報錯”ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: NO)”Errorlocalhost
- MySQL 8.0.13 密碼問題 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)MySql密碼Errorlocalhost
- ERROR 1045 (28000): Access denied for userError
- ERROR 1045: Access denied for user: 'root@localhost' (Using password: NO)Errorlocalhost
- mysql 1045, "Access denied for user 'root'@'localhost' (using password: NO)"MySqllocalhost
- Linux錯誤 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)LinuxErrorlocalhost
- linux安裝MySQL出現ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)LinuxMySqlErrorlocalhost
- MySQL 登入資料庫報錯'ERROR 1045 (28000): Access denied for user'..'@'localhost''MySql資料庫Errorlocalhost
- mysql ERROR 1045 (28000): Access denied for user解決方法MySqlError
- #1045 - Access denied for user 'root'@'localhost' (using password: NO)localhost
- Ubuntu18.04:mysql:ERROR 1698 (28000): Access denied for user ‘root‘@‘localhost‘UbuntuMySqlErrorlocalhost
- 【MySQL】---1045-Access denied for user 'root'@'localhost'(using password :YES)MySqllocalhost
- ERROR 1045 (28000): Access denied for user 'root'@'127.0.0.1' (using password: YES)Error127.0.0.1
- ubuntu mysql Access denied for user root@localhostUbuntuMySqllocalhost
- 解決mysql“Access denied for user 'root'@'localhost'”MySqllocalhost
- MYSQL解決error: 'Access denied for user 'root'@'localhost' (using password:MySqlErrorlocalhost
- MySQL使用普通使用者訪問返回ERROR 1698 (28000): Access denied for user 'root'@'localhost'MySqlErrorlocalhost
- rhel4 mysql5.1登陸ERROR 1045 (28000): Access denied for userMySqlError
- Access denied for user 'root'@'localhost' (using password: NO)localhost
- Mysql 5.7 CentOS Access denied for user 'root'@'localhost'解決方式MySqlCentOSlocalhost
- 解決mysql"Access denied fot user 'root'@'localhost'"問題MySqllocalhost
- 登入mysql報ERROR 1045 (28000): Access denied 解決方法MySqlError
- Access denied for user ‘root‘@‘localhost‘問題的解決localhost
- vue專案中連線MySQL時,報錯ER_ACCESS_DENIED_ERROR: Access denied for user 'root'@'localhost' (using password:YES)VueMySqlErrorlocalhost
- Mysql 5.5 原始碼安裝後建立使用者報錯"ERROR 1045 (28000): Access denied for user"MySql原始碼Error
- ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'mysql'ErrorlocalhostDatabaseMySql
- 啟動報錯:Access denied for user 'root'@'localhost' (using password:YES)localhost
- java.sql.SQLException: Access denied for user ‘root‘@‘localhost‘ (using password: YES)JavaSQLExceptionlocalhost
- MySQL系列:Docker安裝 MySQL提示錯誤:Access denied for user'root'@'localhost' (using password:yes)MySqlDockerlocalhost
- ERROR 1044 (42000): Access denied for user 'root'@'%' to databaseErrorDatabase
- 一看便知linux下mysql報錯ERROR 1044: Access denied for user: '@localhost' to database 'mysql'LinuxMySqlErrorlocalhostDatabase
- mac os x 安裝mysql遇到 Access denied for user ‘root‘@‘localhost‘ (using password: YES)的解決方法MacMySqllocalhost
- Navicat遠端連線MySQL 提示1045 - Access denied for user 'root'@'223.74.158.192'(using password:YES)MySql
- SpringBoot中yml配置java.sql.SQLException: Access denied for user ‘root‘@‘localhost‘ (using password: NOSpring BootJavaSQLExceptionlocalhost