[MySQL] refresh after Windows Recovery MySQL and " Access denied for user& #39;root& #39;@& #39;ip& #39;" Handling issues

Source: Internet
Author: User

MySQL database software is actually green and can continue to be used after reloading the system.


1, reinstall the system to keep the original after the MySQL installation folder, Data folder.

2. Make a batch file to start MySQL: "Run.bat" files are stored under the MySQL installation folder bin.

Mysqld.exe--defaults-file=. /my-default.ini--console

3, run Run.bat can.



Assume the following error occurred while connecting to the database: "Access denied for user ' root ' @ ' IP '"

1. Admin login system, stop MySQL service or end mysqld process
2. Go to the command line and come to the MySQL installation folder. If the installation folder is d:\mysql\, cmd goes to the command line
3. Perform d:\mysql\bin\mysqld-nt--skip-grant-tables start MySQL, turn off check of permissions

4. Perform d:\mysql\bin\mysqladmin-u root flush-privileges password "newpassword" Reset root password
5. Start MySQL service again



Linux systems can be used in the following ways:

Method One:   
#/etc/init.d/mysql stop  
# mysqld_safe--user=mysql--skip-grant-tables-- Skip-networking &  
# mysql-u root mysql  
mysql> UPDATE user SET Password=password (' NewPassword ') where user= ' root ';   
mysql> FLUSH privileges;  
mysql> quit   
#/etc/init.d/mysql restart  
# mysql-uroot-p  
Enter Password: < Enter the new password newpassword>  
mysql>  
Method Two:   
Direct Use/etc/mysql/ Username and password:   provided in the [Client] section of the debian.cnf file;
# mysql-udebian-sys-maint-p  
Enter Password: < Enter the password >   for the [client] section;
mysql> UPDATE user SET Password=password (' NewPassword ') where user = ' root ';   
mysql> FLUSH privileges;  
mysql> quit  
# mysql-uroot-p &NBSP;&NBSP
Enter Password: < Enter the newly created password newpassword>  
mysql>  




Copyright notice: This article Bo Master original articles, blogs, without consent may not be reproduced.

[MySQL] refresh after Windows Recovery MySQL and &quot; Access denied for user& #39;root& #39;@& #39;ip& #39;&quot; Handling issues

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.