Configure SQuirreL with MySQL


SQuirreL is great because is universal and platform independent. You can use it to connect to almost every database that you can imagine.
The only drawback is that it doesn't ship with the database drivers due to licensing issues.

So here is a step-by-step procedure for connecting to MySQL from SQuirreL.

First of all verify that you have network access to the mysql host and its port. Usually mysql servers run at port 3306, so test the connection from your host:
telnet xxx.xxx.xxx.xxx 3306

If you get something like:
Trying 127.0.0.1...
telnet: Unable to connect to remote host: Connection refused

then you won't be able to connect.

The correct response you should get is something like:
Trying xxx.xxx.xxx.xxx...
Connected to xxx.xxx.xxx.xxx.

Then you must check that the database user you will be using has access from the host that the squirrel client will run.

You can check the privileges using phpmyadmin, or by command line:
GRANT USAGE ON *.* TO 'user'@'hostname'

Now go to SQuirrel's website, download and install it.

When you run the program you will see on your left pane a list of database drivers. Most of them are not installed, so we have to manually install the drivers we use often, eg MySQL, Oracle, Sybase etc.

Now, download the mysql jdbc driver from http://dev.mysql.com/downloads/connector/j/

Unzip/untar the downloaded file. Then you should see a file named mysql-connector-java-X.X.XX-bin.jar

This is the mysql jdbc driver.
We are now ready to install the mysql jdbc driver.
Scroll down to the MySQL driver, double-click it and set the Extra Class Path as illustreted below:


Press OK, if everything is fine, then you will see the following screen:


Now you can create your connection(s) to any mysql database(s) by using the aliases tab:



Use the "Test" button to test your connection
Hopefully the connection should be created successfully...

Have fun with your queries!

9 comments:

  1. Thanks a lot for the tutorial, I was stuck with connecting but your tutorial helped me a lot.

    ReplyDelete
  2. Thank you very much for the tutorial, it worked fine :D

    ReplyDelete
  3. Thanks so much for your clear tutorial! The official site certainly lacks a lot of this documentation.

    ReplyDelete
  4. You can check free tool Valentina Studio http://www.valentina-db.com/en/valentina-studio-overview which I think is far superior to other GUI tools.

    ReplyDelete
  5. This comment has been removed by the author.

    ReplyDelete
  6. Thank you so much for this tutorial.
    It is a helpful post.

    ReplyDelete
  7. Great tutorial. I should note that when attempting this with hostgator I could never get telnet to work, but it worked fine when connecting through squirrel. I used my cpanel username and password, and I used the ip address that it showed me inside cpanel on the left column towards the bottom.

    ReplyDelete