Copied!
PHP
Xampp

How to Connect phpMyAdmin (XAMPP / Laragon) with a Remote MySQL Database

how-to-connect-phpmyadmin-xampp-laragon-with-a-remote-mysql-database
Shahroz Javed
Sep 19, 2025 . 61 views

Table Of Contents

 

Introduction

phpMyAdmin is a popular web-based tool bundled with XAMPP and Laragon that lets you manage MySQL databases easily. By default, phpMyAdmin connects to your local MySQL server, but you can also configure it to access a remote database server, just like you do in MySQL Workbench.

⚠️ Note: Make sure your remote MySQL server is configured to allow external connections, and that your IP is whitelisted for access.

Locate the phpMyAdmin Configuration File

In both XAMPP and Laragon, phpMyAdmin settings are managed inside the config.inc.php file.

Edit Configuration to Add Remote Server

Open config.inc.php in a code editor and add a new server configuration block. Each server gets an incremented index ($i++).

$i++;
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['host'] = 'your-remote-host.com'; // Remote DB host or IP
$cfg['Servers'][$i]['user'] = 'db_username';          // Remote DB user
$cfg['Servers'][$i]['password'] = 'db_password';      // Remote DB password
$cfg['Servers'][$i]['port'] = 3306;                   // Default MySQL port
$cfg['Servers'][$i]['ssl'] = false;                   // true if SSL is required
    

Allow Remote Access on the MySQL Server

On the remote server, ensure MySQL is configured to accept remote connections. This usually requires two steps:

Update my.cnf

[mysqld]
bind-address = 0.0.0.0
    

Grant Privileges to Your User

GRANT ALL PRIVILEGES ON mydb.* 
TO 'db_username'@'your.ip.address' IDENTIFIED BY 'db_password';
FLUSH PRIVILEGES;
    
⚠️ Security Tip: Never grant '%' (all IPs) in production. Limit access to specific IPs or use an SSH tunnel.

Test the Connection

Restart Apache in XAMPP or Laragon, then open phpMyAdmin in your browser. You should now see an option in the dropdown to select your new remote server.

💡 Related: You may also want to check our guide on How to Secure phpMyAdmin on Production Servers.

Conclusion

By editing config.inc.php, you can easily connect phpMyAdmin in XAMPP or Laragon to a remote MySQL database. Always ensure your connection is secure—prefer SSH tunneling or VPN when working with sensitive data over the internet.

17 Shares

Similar Posts