I have trouble connecting to MySQL using the client Squirrel SQL. I managed to connect to Oracle and Derby previously, but this time, I do not know what I am doing wrong.
I have installed MySQL on my Mac, following these steps:
To install MySQL:
ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)" brew install git brew update brew install mysql
To secure the installation:
mysql.server start mysql_secure_installation mysql.server stop
To create a new database:
mysql.server start mysql -uroot -pmypassord create database mydb; show databases;
To know where databases are stored:
mysql.server start mysql -uroot -pmypassword SELECT @@datadir, @@innodb_data_home_dir
To create a table
use mydb; create table tblemployee ( employeeID int not null, firstname varchar(50), lastname varchar(50), titleID int, salary float, primary key (employeeID) );
After I followed these steps:
- MySQL was installed under /usr/local/Cellar/mysql/5.6.17
- The database is stored under /usr/local/var/mysql/mydb
- The table tblemployee was created successfully.
In SQuirreL, I then proceeded to install MySQL's driver (mysql-connector-java-5.1.30-bin) and to create an alias with URL as "jdbc:mysql:/usr/local/var/mysql/mydb", User Name as "root" and Password as "mypassword".
But when I try to connect I get the following error message:
Unexpected Error occurred attempting to open an SQL connection.
When I click on Stack Trace, this is what I get:
java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.sql.SQLException: Unable to create connection. Check your URL.
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:202)
at net.sourceforge.squirrel_sql.client.mainframe.action.OpenConnectionCommand.awaitConnection(Unknown Source)
at net.sourceforge.squirrel_sql.client.mainframe.action.OpenConnectionCommand.access$100(Unknown Source)
at net.sourceforge.squirrel_sql.client.mainframe.action.OpenConnectionCommand$2.run(Unknown Source)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.RuntimeException: java.sql.SQLException: Unable to create connection. Check your URL.
at net.sourceforge.squirrel_sql.client.mainframe.action.OpenConnectionCommand.executeConnect(Unknown Source)
at net.sourceforge.squirrel_sql.client.mainframe.action.OpenConnectionCommand.access$000(Unknown Source)
at net.sourceforge.squirrel_sql.client.mainframe.action.OpenConnectionCommand$1.run(Unknown Source)
... 5 more
Caused by: java.sql.SQLException: Unable to create connection. Check your URL.
at net.sourceforge.squirrel_sql.fw.sql.SQLDriverManager.getConnection(Unknown Source)
... 8 more
What am I doing wrong?