Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change MySQL root password in phpMyAdmin

I've setup wamp server on window. Then, I use MySQL root password by cmd. As a result, when I access phpMyAdmin site, Access denied appeared (Default user for phpMyAdmin is root and password is blank/empty). So, how could I change config variables in phpMyAdmin with new password of root.

I've searched for solution on Internet, someone advise me add some line to config.inc.php as:

$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = 'Changed';
$cfg['Servers'][$i]['AllowNoPasswordRoot'] = false;

But, It seem not work. Thanks.

like image 308
Quyen Le Avatar asked May 28 '14 09:05

Quyen Le


People also ask

How do I change MySQL root query password?

To change the root password, type the following at the MySQL/MariaDB command prompt: ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyN3wP4ssw0rd'; flush privileges; exit; Store the new password in a secure location.

What is my phpMyAdmin root password?

You should be able to access phpMyAdmin directly, by browsing to http://127.0.0.1/phpmyadmin. Log in to phpMyAdmin by using the following credentials: Username: root. Password: The same as the application password.


2 Answers

Explain what video describe to resolve problem

After Changing Password of root (Mysql Account). Accessing to phpmyadmin page will be denied because phpMyAdmin use root/''(blank) as default username/password. To resolve this problem, you need to reconfig phpmyadmin. Edit file config.inc.php in folder %wamp%\apps\phpmyadmin4.1.14 (Not in %wamp%)

$cfg['Servers'][$i]['verbose'] = 'mysql wampserver';
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = 'changed';
$cfg['Servers'][$i]['host'] = '127.0.0.1';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['AllowNoPassword'] = false;

If you have more than 1 DB server, add "i++" to file and continue add new config as above

like image 187
Tiep Phan Avatar answered Oct 12 '22 21:10

Tiep Phan


You can change the mysql root password by logging in to the database directly (mysql -h your_host -u root) then run

SET PASSWORD FOR root@localhost = PASSWORD('yourpassword');
like image 26
Dharmesh Hadiyal Avatar answered Oct 12 '22 23:10

Dharmesh Hadiyal