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' (using password:YES)Errorlocalhost
- 報錯”ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: NO)”Errorlocalhost
- 解決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
- Linux錯誤 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)LinuxErrorlocalhost
- 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
- ubuntu mysql Access denied for user root@localhostUbuntuMySqllocalhost
- vue專案中連線MySQL時,報錯ER_ACCESS_DENIED_ERROR: Access denied for user 'root'@'localhost' (using password:YES)VueMySqlErrorlocalhost
- Access denied for user ‘root‘@‘localhost‘問題的解決localhost
- Navicat遠端連線MySQL 提示1045 - Access denied for user 'root'@'223.74.158.192'(using password:YES)MySql
- 啟動報錯: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
- SQLSTATE[HY000] [1045] Access denied for user ‘root‘@‘localhost‘ (using password: YES)”錯誤的隱藏解決辦法SQLlocalhost
- SpringBoot中yml配置java.sql.SQLException: Access denied for user ‘root‘@‘localhost‘ (using password: NOSpring BootJavaSQLExceptionlocalhost
- mac os x 安裝mysql遇到 Access denied for user ‘root‘@‘localhost‘ (using password: YES)的解決方法MacMySqllocalhost
- ERROR 1045 (28000): ProxySQL Error: 報錯ErrorSQL
- load data infile ERROR 1045 (28000)Error
- mysql登入報錯提示:ERROR 1045 (28000)的解決方法MySqlError
- Mysql資料庫報ERROR 1045 (28000)報錯及MySQL忘記密碼找回MySql資料庫Error密碼
- Permission denied:user=xxx,access=WRITE,inode=xxx
- Access denied for user 'default'@'%' to database 'shop'報錯Database
- 【本人親測 已解決】044 - Access denied for user ‘root‘@‘%‘ to database ‘資料庫名稱‘Database資料庫
- 使用Mysql登入時,ERREORE 1045(28000) 解決方法MySql
- laravel mysql批量提交報Access denied 錯誤LaravelMySql
- Caused by: java.sql.SQLException: Access denied for user 'dell-pc'@'xxxxx' (using password: YES)JavaSQLException
- hive建立分割槽表報錯AccessControlException Permission denied: user=NONE, access=WRITE, inodeHiveExceptionNone
- mysqldump Got error: 1045MySqlGoError
- mysql登入遇到ERROR 1045問題解決方法MySqlError
- mybatis進行資料庫建表 CREATE command denied to user 'root'@'127.0.0.1' for table 問題MyBatis資料庫127.0.0.1
- nginx中報Access denied.Nginx
- Docker + maven build problem — unix://localhost:80: Permission deniedDockerMavenUIlocalhost
- OGG Director連線報錯Access denied
- Error: Permission denied @ apply2filesErrorAPP
- Ubuntu git pull 出現Permission denied ErrorUbuntuGitError
- Error: User gpmon is not allowed to login Command CenterError
- Django Error: [WinError 10013] An attempt was made to access a socket in a way forbidden by its access permissionsDjangoErrorORB