Yury Fedorov
Yury Fedorov

Reputation: 14928

PhpStorm MySQL Connector/J stopped working after update to 5.1.40

After PhpStorm suggested to update MySQL driver, my existing and working connections to MySQL databases had stopped working. I saw this problem reproduced on my Ubuntu and on another Mac. The error I received was:

[08S01] Communications link failure.

I use SSH tunneling to access the databases. Also, I use the latest stable version of PhpStorm (2017.1.2). The driver versions that caused troubles were 5.1.40 and 5.1.41 which I installed manually while trying to fix the problem.

Is there a quick way to fix that? I really need to continue working.

Upvotes: 2

Views: 2228

Answers (3)

Sid
Sid

Reputation: 4502

Dont forget to type your db (3306) and SSH ports (in my case it was 22)

Upvotes: 0

Slavik Meltser
Slavik Meltser

Reputation: 10361

There is also an ability to add a driver to the list of MySQL Connector.

enter image description here

In order to do that, follow the steps below:

  1. Navigate to IDE's settings/configurations folder (instructions here).
  2. Enter the ./jdbc-drivers/ folder. You should see in its content something like this: enter image description here
  3. In ./MySQL Connector/J/ create a new folder with the version number, in my case is 5.1.35 (as my previous driver file is ./mysql-connector-java-5.1.35-bin.jar) enter image description here
  4. Copy the file ./mysql-connector-java-5.1.35-bin.jar into the just created version folder (5.1.35). So it'll look like this: enter image description here
  5. Now, edit the file ./jdbc-drivers.xml. enter image description here
  6. Copy the whole <artifact> block with the name MySQL Connector/J with the newer version (in my case 5.1.40), paste it below and change the version for this block to your new version (in my case 5.1.35). It should look something like this: enter image description here
  7. Save the file and restart the IDE.
  8. Got to MySQL driver editor (as @yury-fedorov stated), and now you should see the older version.

You can repeat these steps for any other version you like.

Good luck!

Upvotes: 2

Yury Fedorov
Yury Fedorov

Reputation: 14928

It seems that the latest versions of MySQL Connector/J have some issues. The solution is to rollback to use the previous version of MySQL Connector/J driver in PhpStorm. In my case, the previous version was 5.1.35, which is working fine.

The problem is that the rollback is not that obvious. I didn't have the previous version in a driver selection popup:

missing versions in driver selection

The solution was to add an additional driver file that already existed on my PC:

add additional driver button

Once I added the driver, the last step was to disable the "Use provided driver" checkbox:

disable the checkbox "Use provided driver"

Then I applied the changes, and the connections worked again.

Hope this helps.

Upvotes: 3

Related Questions