本地搭建XAMPP+WordPress遇phpMyAdmin登录及数据库问题求助
Fixing XAMPP phpMyAdmin Login Issues & Infinite Loading
Hey Ivan, let's work through these two common XAMPP/MySQL/phpMyAdmin hiccups you're facing. Here's how to resolve each problem step by step:
1. Can't Log Into phpMyAdmin After Setting MySQL Password
When you set a password for the MySQL root user, phpMyAdmin doesn't automatically sync that password—you need to update its config file manually:
- Locate the
config.inc.phpfile in your XAMPP directory, usually atxampp/phpMyAdmin/config.inc.php. - Open it with a text editor, find the line that reads:
$cfg['Servers'][$i]['password'] = ''; - Replace the empty string (
'') with the password you set for your MySQL root user. If the line is commented out (starts with//), remove the comment to activate it. - Save the file, then restart both Apache and MySQL from the XAMPP Control Panel.
- Try logging into phpMyAdmin again with username
rootand your new password.
If that still doesn't work, verify your MySQL root user's credentials directly via the XAMPP Shell:
- Open the XAMPP Control Panel, click the "Shell" button.
- Run
mysql -u root -p, then enter your password when prompted. If you can log in here, run these commands to refresh permissions:ALTER USER 'root'@'localhost' IDENTIFIED BY 'your_password_here'; FLUSH PRIVILEGES; - Restart MySQL and try phpMyAdmin again.
2. phpMyAdmin Infinite Loading When Skipping Password Setup
This usually happens because MySQL's default authentication plugin has changed (from mysql_native_password to caching_sha2_password), which phpMyAdmin might struggle with when no password is set. Here's how to fix it:
- Open the XAMPP Shell, run
mysql -u root(since you skipped setting a password, you should log in automatically). - Execute these SQL commands to switch the root user back to the native authentication plugin with no password:
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY ''; FLUSH PRIVILEGES; - Close the Shell, restart MySQL from the XAMPP Control Panel.
- Refresh phpMyAdmin—it should load normally now, allowing you to create your WordPress database.
Quick Notes for Next Steps
Once phpMyAdmin is working, make sure to:
- Create a dedicated database for your WordPress site (avoid using the
mysqldefault database). - If you decide to set a password later, remember to update both MySQL and the phpMyAdmin config file as outlined above.
- Always back up your
config.inc.phpfile before making changes, just in case.
内容的提问来源于stack exchange,提问作者Ivan Ivanov
相关产品推荐
相关产品推荐

