0

I had trouble installing a local installation of mysql, so I have a connection to a remote mysql database via an IP tunnel, I connect to it via typing localhost in perl and python scripts. Something weird is happening and I want to check the connection from the command line rather than the script. Is there a BASH command line that I can type to connect to the mysql db as localhost?

Thanks

asked Jan 2, 2010 at 3:03
0

2 Answers 2

3

Err, have you tried the mysql client? It defaults to localhost if -h is not specified.

answered Jan 2, 2010 at 3:05
Sign up to request clarification or add additional context in comments.

2 Comments

so I had a problem installing the mysql client on my machine, hence why I'm using the remote one. So I want to test the remote server rather than the localone, but since I'm using the tunnel, localhost goes to the tunneled machine.
You can specify -h to have any hostname or IP you like.
1

If you want to test MySQL commands from the command line then you will have to install the MySQL command line client.

Another option is to get MySQL GUI Tools, which includes the MySQL query browser. You can execute commands in the query browser just like on the command line.

If you just want to test if the port is open then you can try connecting to it using telnet or netcat:

nc localhost 3306

If the MySQL server is running and you can connect then you should see a version number and then some random characters. Then you will have to press Ctrl-C to cancel the connection. You can't execute SQL like this.

answered Jan 2, 2010 at 3:17

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.