Leon Anavi
IT Tips && Tricks

Databases

Created: 08.09.2009 23:48 Last Modified: 08.09.2009 23:52 Views: 7968
Keywords: MySQL, password, phpMyAdmin, root

MYSQL: Change root Password Using SQL

Tutorial

Log into MySQL, select database mysql and execute an update statement with the new password. It is important to set the user name (root) at the where clause of the statement. The same method can be used to change password of any other user. The changes will take effect after restarting MySQL.

Example

mysql> use mysql;
Database changed
mysql> update user set password=PASSWORD('mypassword') where User='root';
Query OK, 2 rows affected (0.00 sec)
Rows matched: 2  Changed: 2  Warnings: 0

Configure phpMyAdmin

After the change of the root password phpMyAdmin will no longer have access to the database. To fix this issue locate the installation directory of the phpMyAdmin and open file config.inc.php. Navigate to the line that starts with $cfg['Servers'][$i]['password'] and modify it:
$cfg['Servers'][$i]['password'] = 'mypassword';

Reference Manual

UPDATE Syntax


  Home | About | Contact | Disclaimer | Sitemap © 2009-2022 Leon Anavi. All rights reserved.