Solution: 1. Find the "my.ini" system configuration file and put "skip-grant-tables" under "port=****"; 2. If it is placed in the C drive, Then you need editing permissions and save the changes; 3. Restart the service before opening the MySQL database, open the cmd command prompt, directly enter mysql, and press Enter to open the MySQL database.
The operating environment of this tutorial: windows10 system, mysql8.0.22 version, Dell G3 computer.
Open MySQL
Enter mysql, as shown below:
A prompt appears:
ERROR 1045 (28000): Access denied for user ‘ODBC’@‘localhost’ (using password: NO)
means:
Deny access to user "ODBC"@"localhost" (use password: No)
This is not a command to open a MySQL database , so an error will occur. You should use the mysql -u root -p command, and then you will be asked to enter the password. After entering the password, you can enter the MySQL database, as shown below:
1. We find the my.ini system configuration file, open it with Notepad, find [mysqld], and put skip-grant-tables in port=**** Below, as shown below:
##After copying, save it. If you put it in the C drive, Then you need editing permissions, otherwise you will not have permission to save the configuration file. Right click, click Properties Find Security, click Security, the following interface will appear: You can see at this point that individual users do not have writing and modifying permissions. 2. Click Edit, find the user personal user, click to enter the user permission editing mode, check the box to the right of the "Write" permission, click OK, and then click OK, as shown in the figure: This way you can save the changes.3, Restart the service before opening the MySQL database, open the cmd command prompt, enter mysql directly, and press Enter to open the MySQL database.
Recommended learning:The above is the detailed content of How to solve 1045 unable to log in to mysql server. For more information, please follow other related articles on the PHP Chinese website!