Search

reset mysql root password PDF Print E-mail
User Rating: / 0
PoorBest 
Programming - MySQL
Monday, 02 November 2009 11:42

 

 

if using MySql for the first time then we use the command

#mysqladmin -u root password 'yourpassword'

 give your own password for 'your password' but without quotes

if you know your root password and want to reset it. then we can use the command

 #mysqladmin -u root -p'oldpassword' password 'newpassword'

give your old password and new password but without quotes.

if you forgot the root password 

Stop the MySQL server process. Start again with no grant tables. Login to MySQL as root. Set new password. Exit MySQL and restart MySQL server.

# /etc/init.d/mysql stop
# mysqld_safe --skip-grant-tables &
# mysql -u root
mysql> use mysql;
mysql> update user set password=PASSWORD("newrootpassword") where User='root';
mysql> flush privileges;
mysql> quit
# /etc/init.d/mysql stop
# /etc/init.d/mysql start



Add this page to your favorite Social Bookmarking websites
 
Last Updated on Monday, 02 November 2009 12:20
 

Add comment


Security code
Refresh

We have 86 guests online