简体   繁体   中英

Change MySQL Root Password in XAMPP

I've got XAMPP working on my Windows 10 machine. It seems that PHPMyADmin only works if the DB has no password. I'd really prefer to set a password for the root DB account.

I went into the XAMPP control panel -> User Accounts -> Edit Privileges for the root account.

When I enter in a new password and hit 'go', I refresh the page and it says that it can't connect. Is there any way to set the root DB password for XAMPP in such a way that it does not break PHPMyAdmin?

Open C:\xampp\phpMyAdmin folder, and then open config.inc.php :

And then, change the line like this:

$cfg['Servers'][$i]['auth_type'] = 'config'; //change this to cookie from config
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
$cfg['Servers'][$i]['extension'] = 'mysqli';

To:

$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
$cfg['Servers'][$i]['extension'] = 'mysqli';

And login with blank password, and go to SQL tab, and run this:

ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM