tett
tett

Reputation: 605

How to connect to WordPress database remotely?

I have a WordPress website, which is not done by me, all I need to do is connect to its database remotely and query some results from its database. The point is that I don't know anything about WordPress, and I saw that the database information are written inside the wp-config.php file, when I opened it, there was the username and password, but the host name was this:

define('DB_HOST', 'localhost');

Which seems a bit curious to me. The website uses cPanel X from GoDaddy, and when I logged in there and opened phpMyAdmin, it had these information under database server part:

Server: Localhost via UNIX socket

So, I really don't know how to remotely connect to the database and query things, because host name says localhost. I'm used to ASP.NET MVC, and where I specify the host name to be the actual server ip or hostname of the database server. Any idea how should I proceed?

Upvotes: 1

Views: 6163

Answers (2)

Avinash Babu
Avinash Babu

Reputation: 6252

You can do this by using command line.

GRANT ALL ON wpdb.* TO wpuser@`192.168.2.25` IDENTIFIED BY `Pa55w0rd!`;

Check here for a detailed tutorial.

Upvotes: 1

Brian
Brian

Reputation: 3023

This is probably a better question for superuser as it's technically a hosting related question. That being said, you would need to contact GoDaddy and find out if they even allow remote MySQL connections on their servers. Most hosting companies disable external connections to the MySQL server on port 3306, but if you portscan your domain name/IP and see 3306 open then you can probably remote connect to it. Just use the domain name/IP of your site as the host, and pull the user/pass/db name from the config file.

Upvotes: 2

Related Questions