I had been experiencing a problem with the MySQL command line client, mysql, and mysqldump for a few months, when I really needed to make a backup of a database on my local development machine. I generally use MySQL Workbench for day to day tasks, so I had been putting off making a real effort to fix my issue. Each time I tried to use mysql or mysqldump, I got the “Error: 2026” message.
Got error: 2026: SSL connection error: SSL is required but the server doesn’t support it when trying to connect
Horrible. Who needs SSL on localhost?
I did a few cursory searches on Google for “Error:2026”, and all I found was information on how to implement SSL on MySQL, which is exactly the opposite of what I wanted to do. Eventually I stumbled upon a post by Michael Mior on MySQL Client Configuration which pointed me in the right direction.
He pointed out the availability of a feature which enables the use of a MySQL client configuration file in your home directory which can manage aspects of your connection. He was using it to make connecting more convenient, but I thought I would give it a try to see if I could persuade the MySQL command line clients to not require SSL.
I decided to create a “.my.cnf” in my home directory, so I fired up nano to do it:
To my surprise, there was one already, and it looked like this:
And there it was, the root of all my pain. Workbench must have created it when it was installed, I certainly didn’t do it on purpose! I simply removed those pesky lines, and hey presto! No more error message.
I also added my database username and password as parameters, as Michael suggests, and I now have a stress free day ahead of me!