Monday 1 October 2012

MySQL Password Reset

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !


To do so, start the server, then issue the following commands:

/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h svnser.ndotcbe.in password 'new-password'


Alternatively you can run:

/usr/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd /usr/mysql-test ; perl mysql-test-run.pl

An Another way to Reset root password:


Stop MySQL:
root#  service mysqld stop

Start MySQL in safe mode:
root#  mysqld_safe --skip-grant-tables &

Log into MySQL as root:
root#  mysql -u root

Reset the password:
mysql>  update mysql.user set password=PASSWORD("YourNewPassW0RD") where User='root';
mysql>  flush privileges; exit;

Log out of MySQL and stop the Safe Mode:
root#  service mysqld stop

Start MySQL in the normal mode:
root#  service mysqld start

Log into MySQL with your new password:
root#  mysql -u root -p
Enter password:
mysql>


No comments:

Post a Comment