# I have a communications link failure with JDBC MySQL(Connector/J)

I am unable to connect to my local mysql server using Mathematica.

OpenSQLConnection[JDBC["MySQL(Connector/J)",
"jdbc:mysql://localhost/MedusaTrials"],
"Username"->"root"]


returns,

JDBC::error: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. >>


I have had success with remote mysql databases but no success with my local server. In Python SQLAlchemy my database is accessed successfully using

sqlalchemy.create_engine("mysql://root@localhost/test")


I have not been able to translate this access method into the equivalent for Mathematica. I have tried on a number of occasions without success. I have tried to use the wizard

OpenSQLConnection[]


Also without success.

Using Sequel Pro my local data is accessed using the Socket method.

I have researched many questions here but the answer to my problem has eluded me.

Any help will be most appreciated.

• I have found the problem (or at least my son did!). mysql is running as port 3307. I did this many years ago because I was running 2 instances of mysql at different revisions and used the port to differentiate. – Nigel King Jul 25 '16 at 9:36

## 1 Answer

If you have this problem one of the things to check for is the port number that mysql is listening to a terminal command that will do this is:

ps -ef | grep mysqld


it may show the port number in its response.