Connect to GCP MySQL through XAMPP


XAMPP is the most popular PHP development environment including a great GUI - phpMyAdmin, I would like to connect it to a cloud MySQL DB - Google Cloud Platform MySQL.


  1. XAMPP installed
  2. Create a Google Cloud Platform (GCP) account

Solution steps

  1. Go to Google Cloud Platform (GCP)
  2. Select SQL from the sidebar
  3. Create a MySQL instance, please do keep your password
  4. Wait a few minutes for Google setup the MySQL instance
  5. Click your instance name
  6. Go to overview tab and copy MySQL IP address, e.g.
  7. Open XAMPP phpMyAdmin Config, located in XAMPP > Apache > Config > phpMyAdmin(
  8. Edit following lines in the configuration

    /* Paste username / password */
    $cfg['Servers'][$i]['user'] = 'root';
    $cfg['Servers'][$i]['password'] = '<your password>';
    /* Paste MySQL ip address */
    $cfg['Servers'][$i]['host'] = '';    
  9. Go to Authorization(連線設定) tab
  10. Click Add network under public ip
  11. Paste your ip address, which could be found through What is my ip
  12. Start XAMPP Apache, go to http://localhost/phpmyadmin/ and find it is connected, enjoy :)