MySQL database password forgotten how to do?

  Forgot your MySQL database password database to get in, it can not alter the code, the solution is as follows:

  1: Open cmd command symbol, the database is running close to, enter the following:

    

  2: Open the file mysql.exe and mysqld.exe where the folder, copy the path address

    

   3: Enter the command mysqld --skip-grant-tables the transport, then skip the mysql user authentication. Note After you enter this command on the command line can not operate, and then you can then open a new dos window into the bin directory of mysql.  

    

      This is the second window as follows: direct input mysql, do not need to take any login parameters can directly enter the landing on the database

    

  4 :: Enter show databases; you can see all the database description successful landing. Which is to save the mysql database user name of the place, input use mysql; select mysql database.

    

  5: show tables to see all the tables, you will find a user table, where the store is a user name, password, permissions, and so account information.  

    

    As can be seen with the user tool MySQL View fields in the table

    

   6 :: input select user, host, password from user; to view account information.  

    

  7: change the root password, input update user set password = password ( 'admin123') where user = 'root' and host = 'localhost';

    

    8: Close the two windows and restart mysql database, try to log in with the new password.    

    

 

  The above steps are for reference only, actual use is not very common, but more complex step, recorded for future reference

 

 

 

Guess you like

Origin www.cnblogs.com/ttxcs/p/11614391.html