How to Connect XAMPP to an External MySQL Database?

7 minutes read

To connect XAMPP to an external MySQL database, follow these steps:

  1. Start by opening the XAMPP control panel and ensuring that both the Apache and MySQL modules are running.
  2. Locate the "phpMyAdmin" directory in the XAMPP installation folder. Usually, it can be found in the "htdocs" folder.
  3. Open the "" file within the "phpMyAdmin" directory, using a text editor like Notepad.
  4. Look for the following lines of code: /* User for advanced features */ $cfg['Servers'][$i]['controluser'] = 'root'; $cfg['Servers'][$i]['controlpass'] = ''; Replace 'root' with the username of your external MySQL database.
  5. Find the following line: $cfg['Servers'][$i]['host'] = 'localhost'; Update 'localhost' with the IP address or hostname of your external MySQL database.
  6. Save the changes made in the "" file and close the text editor.
  7. Restart the Apache module in XAMPP to apply the changes.
  8. Now, you should be able to access the external MySQL database through XAMPP's phpMyAdmin interface by entering the hostname or IP address of the external database in the browser.

By following these steps, you should successfully connect XAMPP to an external MySQL database.

Best Cloud Hosting Providers in 2024


Rating is 5 out of 5


  • Ultra-fast Intel Core
  • High Performance and Cheap Cloud Dedicated Servers
  • 1 click install Wordpress
  • Low Price and High Quality
Digital Ocean

Rating is 5 out of 5

Digital Ocean

  • Active Digital Community
  • Simple Control Panel
  • Starting from 5$ per month

Rating is 5 out of 5



Rating is 5 out of 5


How to reset XAMPP's MySQL root password?

To reset XAMPP's MySQL root password, you can follow these steps:

  1. Stop the Apache and MySQL servers in XAMPP.
  2. Open the file my.ini (Windows) or my.cnf (macOS) located in the XAMPP installation directory.
  3. Look for the [mysqld] section and add the following line below it: skip-grant-tables
  4. Save the file and start the XAMPP Apache and MySQL servers.
  5. Open a web browser and navigate to http://localhost/phpmyadmin.
  6. Click on the "User accounts" tab.
  7. Locate the root user and click on the "Edit privileges" icon (pencil icon).
  8. In the settings page, set a new password for the root user and make sure to select the "Password" authentication method.
  9. Click on the "Go" button to save the changes.
  10. Stop the XAMPP servers again.
  11. Open the my.ini (Windows) or my.cnf (macOS) file once more.
  12. Remove the line skip-grant-tables that you added earlier.
  13. Save the file and start the XAMPP Apache and MySQL servers again.

Now you should be able to log in to MySQL using the new password you set for the root user.

What is the maximum number of simultaneous connections allowed in XAMPP's MySQL?

By default, XAMPP's MySQL allows a maximum of 151 simultaneous connections. However, this value can be adjusted by modifying the "max_connections" configuration parameter in the MySQL configuration file (my.ini or my.cnf). Keep in mind that increasing the number of simultaneous connections may require more system resources and can potentially affect the performance of the server.

What is the best practice for managing user privileges in XAMPP's MySQL?

The best practice for managing user privileges in XAMPP's MySQL includes the following steps:

  1. Create a dedicated user for each application or system component that requires database access. This ensures that privileges are granted only to the necessary users and not to a generic user account.
  2. Grant the minimum required privileges to each user. Avoid granting global privileges unless absolutely necessary. Granting only the necessary privileges ensures that the user can perform the required operations without unnecessary access to sensitive data or functions.
  3. Use strong and unique passwords for each user account, and regularly update them. In addition, avoid using default usernames and passwords to enhance security.
  4. Regularly review and update the privileges granted to users based on their role and requirements. Remove any unnecessary privileges that might have been granted in the past.
  5. Restrict access to the MySQL server by specifying IP address-based access controls. This ensures that only trusted sources can connect to the database server.
  6. Regularly monitor the MySQL server logs for any suspicious or unauthorized activity. This helps in identifying any potential security breaches.
  7. Keep your XAMPP installation and MySQL server up to date with the latest security patches and updates to address any known vulnerabilities.
  8. Regularly back up your databases to avoid data loss and enable restoration in case of any security incidents.

By following these best practices, you can ensure that user privileges in XAMPP's MySQL are appropriately managed and your database remains secure.

How to find the IP address of an external MySQL database?

To find the IP address of an external MySQL database, you can follow these steps:

  1. Launch your command prompt or terminal.
  2. Ping the hostname or domain name of the MySQL server using the "ping" command, followed by the domain name. For example: ping This will display the IP address of the server if it is reachable.
  3. If you don't have the domain name, try using online tools like "nslookup" or "dig." Open your browser and search for "nslookup" or "dig tool."
  4. Enter the domain name of the MySQL server in the provided field and click on the search button. This will display the IP address associated with the domain name.
  5. Alternatively, you can contact the server administrator or the provider of the MySQL database and ask for the IP address.

Note: It's important to have proper authorization and permission to access the external MySQL database before attempting to connect to it.

Facebook Twitter LinkedIn Telegram Whatsapp Pocket

Related Posts:

To add Python to XAMPP, follow these steps:Download and install XAMPP from the official Apache Friends website.Download and install Python from the official Python website.Open the XAMPP installation folder (usually located in C:\xampp).Locate the "xampp-c...
Starting the XAMPP control panel is a simple process. After installing XAMPP on your computer, follow these steps:Open the XAMPP installation folder on your computer. The default installation location is usually "C:\xampp" on Windows or "/Applicati...
To create a simple PHP file and run it in XAMPP, follow these steps:Install XAMPP: Download and install XAMPP from the Apache Friends website ( Choose the appropriate version for your operating system. Start XAMPP: Lau...