In the process of actually logging in to Redmine, we encountered the following error
Error 1045 (28000): Access denied for user ' root ' @ ' localhost ' (using Password:no) Error 1045 (28000): Access denied for us Er ' redmine ' @ ' localhost ' (using Password:yes)
Solution 1---Empty user error.
Solution 2---Windows reset the MySQL root account password.
Solution 2---Linux reset the MySQL root account password.
==============================================
The following is a preliminary analysis of a solution based on the Internet:
Solution 1---Empty user error
1. Disable MySQL service:
# service MySQL Stop
2. Enter the command:
# Mysqld_safe--user=mysql--skip-grant-tables--skip-networking &
3. Log in to the database:
# mysql-u Root MySQL
4, mysql> use MySQL;
5, mysql> select User,host,password from user;
The results are as follows:
+------+-----------------------+----------+
| user | Host | password |
+------+-----------------------+----------+
| Root | % | Mima |
| Root | Localhost.localdomain | Mima |
| Root | 127.0.0.1 | Mima |
| | localhost | |
| | Localhost.localdomain | |
+------+-----------------------+----------+
6, the above query out of the empty user delete:
mysql> Delete from user where user= ';
7. Exit the database:
Mysql> quit
8. Start the MySQL service:
# service MySQL Start
9. Re-use the command:
Mysql-u root-p
Login, ok!
Solution 2---Windows reset the MySQL root account password.
Search the My.ini file for the MySQL directory on Windows,
Add skip-grant-tables to this entry under [Mysqld]
Restart MySQL after saving exit
1. Click "Start", "Run" (shortcut key Win+r).
2. STOP: Enter net stop MySQL
3. Start: input net start MySQL
At this time in the cmd input mysql-u root-p can be used without password login, appear password: when the direct return can enter, will not appear error 1045 (28000), but many operations will be limited, Because we can't grant (without permission).
Follow the process below (the red part is the input section, the pink One is the code shown after the execution does not have to be entered):
1. Go to MySQL database:
mysql> use MySQL;
Database changed
2. Set a new password for the root user, and enter the blue part yourself:
mysql> Update user Set Password=password (" New password ") where user= "root";
Query OK, 1 rows affected (0.01 sec)
Rows matched:1 changed:1 warnings:0
3. Refreshing the database
mysql> flush Privileges;
Query OK, 0 rows Affected (0.00 sec)
4. Exit MySQL:
Mysql> quit
Bye
After the change, and then modify the My.ini this file, we just joined the "Skip-grant-tables" this line to delete, save the exit and then restart MySQL.
Solution 2---Linux reset the MySQL root account password.
1. Disable MySQL service:
# service MySQL Stop
2. Enter the command:
# Mysqld_safe--user=mysql--skip-grant-tables--skip-networking &
3. Log in to the database:
# mysql-u Root MySQL
4, mysql> use MySQL;
5, mysql> Update user set Password=password (" New password ") where user= "root";
Query OK, 0 rows affected (0.13 sec)
Rows Matched:4 changed:0 warnings:0
6. Refresh the database
mysql> flush Privileges;
Query OK, 0 rows affected (0.05 sec)
Mysql> quit
Bye
6. Restart $ sudo service mysql start
MySQL start/running, process 12719
7. Login:
$ mysql-u Root-p
Enter Password:
Welcome to the MySQL Monitor. Commands End With; or \g.
Your MySQL Connection ID is 49
Server version:5.5.54-0ubuntu0.14.04.1 (Ubuntu)
Copyright (c), Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of the Oracle Corporation and/or its
Affiliates. Other names trademarks of their respective
Owners.
Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.
Mysql>
Successfully logged in.
Welcome to the Exchange!
Reference:
Http://www.jb51.net/article/82421.htm
Http://blog.sina.com.cn/s/blog_759a5a7c01017dj0.html
MySQL ERROR 1045 (28000): Access denied for user possible workaround analysis