Connectiong to mysql server

How do you go about connecting to mysql that is not local? I know the command-line to do it locally on my mac… but what if it’s not local?

the only info I have is the user name and password… wouldn’t I need the host name as well for the -h ?

Thanks in advance :wink:

Are you trying to connect to MySQL from a server-side language (if so which one)?

Well I know when I was doing it locally, I was just using terminal to see the database.

A friend just gave me a username and password for his mysql and I was under the assumption I could still use terminal to connect to view the database?

Is this incorrect?

The language all of it’s done in is php if that helps at all. It’s a wordpress site. He gave me ftp access which I needed to do some things, but also sent me a username/password for mysql too, which I don’t have much experience with.

The database connection info for WP goes into a file you’ll find in the wordpress folder called wp-config.php (unless your actually installing it). You’ll need to ask your friend what the hostname is. Is the Wordpress site located on the same physical server box as MySQL?

Yes it’s located on the same physical server box as the site.

I just asked him for the hostname as well.

As it’s on the same physical server, try ‘localhost’ for the hostname

So I can use localhost from my terminal even though it’s not local on my machine.

When WP is connecting to MySQL on the same server box it should be ‘localhost’, for you to connect from your terminal the hostname will either be a domain or an IP address (in either case you’ll need to get the value to use from your friend).

So is there another way to view the database that’s easier than using terminal? Since it’s a wordpress site?

There is PHPMyAdmin which will most likely be installed on the server

Yeah, it is. It’s got cpanel which has that, I just don’t have access to the actual server :wink:

Good to know though. Thanks for the help.