Difference between revisions of "Reset MySQL root password"

From Organic Design wiki
(Change source-code blocks to standard format)
(redirect)
Line 1: Line 1:
{{procedure
+
#redirect [[MediaWiki SQL queries#Reset a user password]]
|status = In use
 
|role = sysop
 
}}
 
To reset the root password of a MySQL server, first go to a root shell and stop MySQL:
 
<source>
 
service mysql stop
 
</source>
 
 
 
 
 
Next, run MySQL in safe mode in the background:
 
<source>
 
mysqld_safe --skip-grant-tables &
 
</source>
 
 
 
 
 
Reset the MySQL root password:
 
<source>
 
mysql -u root
 
use mysql
 
update user set password=PASSWORD("NEW-ROOT-PASSWORD") where User='root';
 
flush privileges;
 
quit
 
</source>
 
 
 
 
 
And restart the MySQL server again:
 
<source>
 
service mysql start
 
</source>
 

Revision as of 01:18, 22 July 2019