Tuesday, October 12, 2010

Reset MySQL password

$ sudo service mysql stop
$ sudo mysqld_safe --skip-grant-tables
$ mysql -u root
mysql> update mysql.user set password=password('newpassword') where user='root';
mysql> flush privileges;

http://www.tech-faq.com/how-do-i-reset-a-mysql-password.html

To assign passwords to the root accounts using mysqladmin, execute the following commands:
shell> mysqladmin -u root password "newpwd"
shell> mysqladmin -u root -h host_name password "newpwd"

No comments: