In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article introduces the "MySql error code 1045 how to solve" the relevant knowledge, in the actual case of the operation process, many people will encounter such a dilemma, and then let the editor lead you to learn how to deal with these situations! I hope you can read it carefully and be able to achieve something!
Error code 1045
Access denied for user 'root'@'localhost' (using password:YES)
The solution is to reset the root user password. On Windows platform, the steps are as follows:
1. Log in to the system as a system administrator
If the MySQL server is running, stop it.
If it is a server running as a Windows service, go to Service Manager: start menu-> Control Panel-> Administrative tools-> Services
If the server is not running as a service, you may need to use Task Manager to force it to stop.
Create a text file and put the following commands on a single line:
SET PASSWORD FOR 'root'@'localhost' = PASSWORD (' MyNewPassword')
Save the file with any name. In this case, the file is C:\-init.txt.
4. Enter the DOS command prompt: start menu-> run-> cmd
Suppose you have installed MySQL to C:\ mysql. If you installed MySQL to another location, please adjust the following command accordingly.
From the DOS command prompt, execute the command:
C:\ > C:\ mysql\ bin\ mysqld-nt-- init-file=C:\ mysql-init.txt
When the server starts, the contents of the file named by the "--init-file" option (function: read the SQL command from the specified file at startup) are executed, and the root password is changed. When the server starts successfully, you should delete C:\ mysql-init.txt.
Stop the MySQL server and restart it in normal mode. If you run the server as a service, you should start it from the Windows services window. If you start the server manually, you can use commands as you would normally do.
Attached:
Other methods
Method 1: (recommended)
Mysql > use mysql
Mysql > UPDATE user SET Password=PASSWORD ('your new password') where USER='root'
Mysql > FLUSH PRIVILEGES
Mysql > quit
Method 2:
Directly use the username and password provided in the [client] section of the / etc/mysql/debian.cnf file:
# mysql-udebian-sys-maint-p
Enter password:
Mysql > UPDATE user SET Password=PASSWORD ('newpassword') where USER='root'
Mysql > FLUSH PRIVILEGES
Mysql > quit
# mysql-uroot-p
Enter password:
Mysql >
Another way.
Windows:
1. The administrator logs in to the system, stops the mysql service or ends the mysqld-nt process
two。 Enter the command line and go to the directory where mysql is installed. Suppose the installation directory is d:\ mysql\, and CMD enters the command line
3. Run d:\ mysql\ bin\ mysqld-nt-- skip-grant-tables to start mysql and turn off permission check
4. Run d:\ mysql\ bin\ mysqladmin-u root flush-privileges password "newpassword" to reset the root password
5. Restart the mysql service
This is the end of the content of "how to solve the error code 1045 in MySql". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.