The best tested solution for mysql password forgetting

  • 2020-05-06 11:46:53
  • OfStack

The best solution to mysql password forgetting  , after testing, if not successful is generally your mysql running abnormal
Solution:
Under windows:  

 Open a command line window and stop mysql Services:      
Net stop mysql  
 Start the mysql And the more general to the mysql The installation path is found  mysqld-nt.exe  
 Perform: mysqld-nt --skip-grant-tables  The current window will stop.   
 Also open a command line window and execute mysql    If not, enter first MYSQL Under the installation location BIN Directory rerun mysql  
>use mysql  
>update user set password=password("new_password") where user="root";  
>flush privileges;  
>exit  
 with Ctrl+Alt+Del To find mysqld-nt The process to kill it at restart mysql-nt Service, you can log in with your new password 


under linux:

 if  MySQL  Running, first kill it:  killall -TERM mysqld .    
 Start the  MySQL  : bin/safe_mysqld --skip-grant-tables &   
 You can enter without a password  MySQL  .    
 And then there is    
>use mysql  
>update user set password=password("new_pass") where user="root";  
>flush privileges;  
 To kill  MySQL  , starting in the normal way   

Related articles: