Resetting the MySQL server password on Ubuntu

To Reset the MySQL server password running on Ubuntu follow the below steps.

Check the version of your mysql-server. To do this open terminal and type the below command

apt-cache policy mysql-server

Some lines of information is displayed  look for the line that says about the installed version



For example in my system the version installed is [ 5.5.38-0ubuntu0.14.04.1 0 ]  (From this I know that I have mysql-server-5.5 installed in my system.)

Start the reconfiguration with:

sudo dpkg-reconfigure mysql-server-*.*       

where mysql-server-*.* should be replaced by the version that you have. (for me it'd be mysql-server-5.5). 


This will stop the database daemon. 

A prompt will then appear where you'd have to enter your new password and confirm the reconfiguration.




The daemon will be automatically started after the reconfig completes.

You can then log in with:

mysql -u root -p

The server will prompt you for the password after entering it start your database admin tasks.



No comments:

Post a Comment