Recover MySQL root password
by Mohan[ Edit ] 2012-09-20 08:11:18
<h2>Recover MySQL root password</h2>
If you have lost the MySQL root password, or just donât remember it, donât worry, follow the step by step for you to retrieve it
Stop the MySQL service if it is running â/etc/init.d/mysql stopâ
Up the Server âskipingâ the layer responsible for checking the user privileges mysqld_safe-skip-grant-tables , remembering , when you start the server with this option, it will accept any user to connect to database MySQL database with full access to all the databases, then to inhibit other people from connecting to the server during the maintenance period, I suggest you use the following command to start the server mysqld_safe â skip-grant-tables â skip-networking. In this case the server not accept connections over TCP/IP
Connect to server with the command mysql -u anything
Enter update mysql.user set Password=PASSWORD(ânew-passwordâ) WHERE User=ârootâ
Stop the server whit the command mysqladmin -u qualquer_coisa shutdown and start again with without skiping commands mysqld_safe