How to Set the XAMPP root Password to root to Match MAMP
- 開発環境
- Windows
Note: The screenshots in this article were captured in a Japanese-language Windows environment. Menu and setting names may differ slightly in an English-language installation.
For the Mac version of MAMP's MySQL, the default username and password are both root. In the MariaDB that ships with the Windows version of XAMPP, in the verification environment used here, root@localhost has no password set. As-is, you would need to switch connection information when using the same PHP application or configuration file on Mac and Windows.
In this article, to align the connection information for local development, we will change the XAMPP root@localhost password to root and update phpMyAdmin's config.inc.php accordingly.
| Verification items | Content |
|---|---|
| Windows environment | XAMPP 8.2.12、MariaDB 10.4.32、phpMyAdmin 5.2.1 |
| environment to prepare | Mac version MAMP |
| username | root |
| password | root |
| Purpose | Local development environment only |
If XAMPP has not been installed, please first follow "How to install the Windows version of XAMPP." To edit config.inc.php, you can use a text editor such as the one covered in "How to install VSCode."
Reasons for aligning MAMP and XAMPP connection information
According to the MAMP official documentation, the default MySQL connection information for the Mac version of MAMP is shown below.
| Item | MAMP default value |
|---|---|
| username | root |
| password | root |
By setting the same value for XAMPP on the Windows side, you can share the user name and password when moving PHP applications between local environments. However, MAMP and XAMPP may have different default ports, sockets, etc., so not all connection information is the same.
Points to note before setting
If you change your password, you will no longer be able to connect from PHP apps or database management tools that use the old connection information. Check the following before proceeding:
- Back up the required databases
- Only use MariaDB and phpMyAdmin from
localhost - Don't use root as the connecting user for production apps
- Disallow external connections through Windows Firewall or MariaDB
- Check if an existing app is using an empty root password
XAMPP is a package for local development. The Apache Friends FAQ for Windows states that it is not intended for production use, and that exposing phpMyAdmin externally carries significant risk.
Check the current root account
1. Start Apache and MySQL in the XAMPP Control Panel.
2. Open http://localhost/phpmyadmin/ in your browser.
3. Check the "Database Server" field on the top page.

The verification environment for this article has the following configuration.
| Item | value |
|---|---|
| server | 127.0.0.1 via TCP/IP |
| Server type | MariaDB |
| server version | 10.4.32-MariaDB |
| current user | root@localhost |
| PHP version | 8.2.12 |
4. Open "User Account" in the top menu.
5. Check the Password column for root@localhost.

In MariaDB, an account is a combination of username and connection source host. This article changes root@localhost; root@127.0.0.1 and root@::1 will be treated as separate accounts.
Change root password to root
1. Click Edit Permissions for root@localhost.
2. Open the "Change password" tab on the permission editing screen.


3. Select Password:.
4. Enter root in both "Password" and "Re-enter"

phpMyAdmin's strength display shows that the password is weak. This is as expected and is a local-only setting for compatibility with MAMP defaults.
5. Password hashing does not change from the default value in the verification environment unless the app specifies a different method.
6. Click Run.
7. Confirm the message that the password for root@localhost has been changed.
Why is Access denied displayed?
Immediately after changing your password, you may receive the following error:

mysqli::real_connect(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: NO)
This happens because XAMPP's phpMyAdmin was using config authentication with an empty password, which no longer matches the new root password on the MariaDB side. If the password change itself was successful, update the connection information on the phpMyAdmin side using the following steps.
Update config.inc.php in phpMyAdmin
1. Open C:\xampp\phpMyAdmin in Explorer.
2. Before editing, create a backup of config.inc.php.
3. Open config.inc.php in a text editor.

4. Look for authentication settings. Line numbers vary depending on your environment.

The example before the changes is as follows:
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
$cfg['Servers'][$i]['AllowNoPassword'] = true;
5. Set the password to root and disable passwordless connections.
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = 'root';
$cfg['Servers'][$i]['AllowNoPassword'] = false;
6. Save the file.
With config authentication, the password is saved in plain text in the configuration file, and login happens automatically. This method suits our purpose of using the same credentials for local development on MAMP and XAMPP. If you're not using a shared PC or an externally exposed environment and need stronger authentication, check the phpMyAdmin official authentication mode documentation and consider cookie authentication.
Check the operation after setting
1. Reload http://localhost/phpmyadmin/ in your browser.
2. Verify that the Access denied error disappears.
3. Make sure you can open the database list and the root@localhost permissions screen.

Next, check if you can connect from a local app using the same credentials.
username: root
password: root
If you cannot connect, also check the hostname, port number, and host part of the target root account. Depending on the configuration, MAMP often uses port 8889, while XAMPP generally uses 3306, so even with the same passwords, the port numbers may differ.
Reference materials
- How to connect from MAMP to MySQL
- MAMP MySQL root password change
- phpMyAdmin authentication mode
- XAMPP Windows FAQ(Apache Friends)
Summary
| Item | Setting details |
|---|---|
| purpose | Unify local DB credentials between MAMP on Mac and XAMPP on Windows |
| MariaDB account | root@localhost |
| Setting password | root |
| phpMyAdmin authentication | config authentication |
config.inc.php | Password changed to root, AllowNoPassword changed to false |
| Usage range | localhost limited development environment |
With this setting, MAMP and XAMPP can share the same root / root connection information. However, this setup is for local-development portability only. Do not use it in an externally exposed environment — set up dedicated users and strong passwords for each purpose there.
Related Articles
-
How to Install nvm-windows on Windows 10 and 11
-
How to Install and Switch Between Node.js and npm Versions with nvm on Windows
-
How to Install XAMPP for Windows: Apache, MariaDB, and PHP
-
How to Install VS Code on Windows 10 and 11
-
How to Configure AllowOverride in Apache and Enable .htaccess
-
Why Commands After npm Do Not Run in Windows Batch Files and How to Use call