• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

Startup Hero

The Official Blog Of Name Hero

Learn To Fly Above The Competition Get Started
  • HomeWelcome
  • CoursesVideo Training Center
  • About UsWhat is StartupHero?
  • BlogGet the latest
  • Start HereStartup 101
  • SpeakingPodcast & Media
  • ResourcesTools to help You
    • Reselling WordPress Hosting
    • Resell Hero
    • How To Start A Blog
  • NameHeroCloud Web Hosting

How To Connect Remotely To The WordPress MySQL Database

By Bhagwad Park on August 13, 2018 4

How To Connect Remotely To The WordPress MySQL Database

WordPress lives in its database. The files and folders on your server are for appearances only. CSS, Javascript, and PHP files can usually be replaced from other sources. But your content – that is what makes your site special and unique. And that content lives in the database. If you had to pluck out one component of your WordPress site and carry it with you, it would be the MySQL database.

In this article, I’ll show you how to connect to MySQL remotely. While it’s possible to do this from cPanel using phpMyAdmin, it’s a bit clumsy and requires you to go through several steps each time. By accessing the database from a local client, you can do things faster, and also set up complex operations like schedules etc. So let’s get started.

Step 1: Download and Install HeidiSQL

When it comes to the choice of MySQL clients, my vote goes to HeidiSQL. It’s smaller and less cumbersome than the MySQL workbench, so that’s what I’ll use in this tutorial. It’s free and open source – what’s not to love? You can download it from here. It’s also available in the Windows store, so if you’re on Windows 10, it might be easier to get it from there.

Step 2: Gather the Necessary Information

To make a remote connection to your MySQL database, you need the following pieces of information:

  1. Your database username
  2. Your database password
  3. The server hostname or IP address
  4. Your LOCAL IP address from which you will access the server

Get the Database Username and Password

Go into your WordPress root folder and open the file called “wp-config.php”. Here, you will find your database username and password as shown here:

Get the Database Name

Get your Hostname or IP Address

Log into the cPanel interface of NameHero, and you will see your primary domain on the right-hand side as shown here. We’ll use this as the hostname. You can also click the “Server Information” link on the bottom to get the IP address instead.

Get your Local IP Address

This is easy. Go to google.com, and type in “what is my ip”. Google will respond with the IP address of your local system as shown here:

Get your IP Address

Step 3: Setting up Remote MySQL Access

By default, servers don’t allow remote access to their databases except from specific IP addresses. So we need to add our IP address to the whitelist.

Log into your cPanel, and find the icon titled Remote MySQL as shown here:

Remote MySQL Database in cPanel

In the following screen, add the LOCAL IP address you got in step 2 and click “Add Host”.

Add Access Host

You should see a confirmation screen as shown here:

Access Host Added

Now we have permissions for remote access. Keep in mind that your local IP address can change at the whims of your ISP. It may not happen often, but it can happen. Also if you connect through a VPN, the IP address will change as well. So take all this into consideration!

Step 4: Set up a New Session with HeidiSQL

Open HeidiSQL and click “New” at the bottom left as shown here:

Create a New Session in HeidiSQL

Enter a name for the new connection on the left-hand panel. On the right, enter the credentials you got in step 2. Namely, the IP address or hostname, your username, and the password for your database.

Enter Database Credentials

Now click the “Save” button for the session. Once done, click “Open”.

If all goes well, it should initiate a remote MySQL connection to your database as shown here:

Connect Remotely to the WordPress MySQL Database

It will display a list of all the databases attached to your account. From here, you can run SQL queries, view data, take backups and restore stuff with the click of a button. It’s much faster and easier to access than phpMyAdmin!

Bhagwad Park Profile Picture
Bhagwad Park

I’m a NameHero team member, and an expert on WordPress and web hosting. I’ve been in this industry since 2008. I’ve also developed apps on Android and have written extensive tutorials on managing Linux servers. You can contact me on my website WP-Tweaks.com!

Reader Interactions

Comments

  1. Bobby says

    May 25, 2019 at 5:12 pm

    Good day, I tried but no luck. So the wordpress site installed on windows server 2016. The mysql database is stored on the c drive of the server. I tried your method using domain name and ip address and they came up nothing.

    Reply
    • Ryan Gray says

      May 27, 2019 at 11:36 am

      Unfortunately I’ve never connected it to a Windows server, what is the error it’s kicking?

      Reply
  2. Peter says

    February 25, 2021 at 11:10 am

    Nicely explained. Though I use another DB client, pretty straight forward and works well. Thanks for the guidance.

    Reply

Trackbacks

  1. How To Schedule And Download WordPress Database Backups says:
    August 15, 2018 at 12:36 pm

    […] a previous article, I’d shown you how to connect to your MySQL WordPress database remotely through the HeidiSQL program. Now if you need to take a backup, it’s extremely easy. Just […]

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Connect With Us!

Superhero Resources

Fix Common Issues

  • How To Setup Free And Automatic SSL Certificates
  • How To Setup Cloudflare With Railgun
  • How To Fix Memory Exhausted Errors In WordPress
  • How To Edit PHP Version/Upload Limit/Add Extensions
  • How To Move/Migrate Your Business To Name Hero

Free Guides

  • How To Setup NameHero Hosting
  • How To Create A Web Hosting Business With WordPress
  • How To Start A WordPress Blog
  • How To Migrate WordPress To A VPS
  • How To Speed Test And Optimize Your WordPress Website
  • Magento 2.X Installation Guide
  • How To Clean Up A WordPress Hack

Training

Recent Posts

  • The Best WordPress Plugin To Combat Plagiarism
  • Is It Time to Bring Back Blog Comments?
  • Two Filters That No Longer Work In Gutenberg (And Workarounds)
  • Migrating To The New Cloudflare Managed Rules Interface
  • How To Sort Posts By The “Last Modified” Date
  • How To Make WordPress Send E-mail From Another Address
Subscribe in a reader
  • Web Hosting
  • WordPress Hosting
  • Reseller Hosting
  • VPS Hosting
  • Twitter
  • Facebook
  • LinkedIn
  • YouTube
  • FTC Disclosure
  • Earnings Disclosure
  • Privacy Policy

Copyright © 2023 · Smart Passive Income Pro on Genesis Framework · WordPress · Log in