Homebrew / homebrew-core

🍻 Default formulae for the missing package manager for macOS (or Linux)
https://brew.sh
BSD 2-Clause "Simplified" License
13.63k stars 12.36k forks source link

MySQL 5.7.16 - ERROR 2026 (HY000): SSL connection error: error:00000001:lib(0):func(0):reason(1) #6753

Closed conorfi closed 7 years ago

conorfi commented 7 years ago

description Using brew to install mysql(5.7.16) seems to cause this error

ERROR 2026 (HY000): SSL connection error: error:00000001:lib(0):func(0):reason(1)

This seems to be the same issue experinced in 46055

other info I performed a brew install of mysql(5.7.16) brew install mysql The following info is displayed

$ brew info mysql
mysql: stable 5.7.16 (bottled)
Open source relational database management system
https://dev.mysql.com/doc/refman/5.7/en/
Conflicts with: mariadb, mariadb-connector-c, mysql-cluster, mysql-connector-c, percona-server
Not installed
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/mysql.rb
==> Dependencies
Build: cmake ✘
Required: openssl βœ”
==> Requirements
Required: macOS >= 10.7 βœ”

When i try to connect to a server i get the following error

$ mysql -h <myserver> -u <myuser> -p
Enter password: 
ERROR 2026 (HY000): SSL connection error: error:00000001:lib(0):func(0):reason(1)

as a temporary solution i could disable ssl from the command line

$ mysql -h <myserver> -u <myuser> -p --ssl-mode=DISABLED
Enter password: 

or by creating a my.cnf file

$ cat /etc/my.cnf 
[client]
ssl-mode=DISABLED

but as i am using a ruby database driver in my testcases, the SSL connection errors in the test cases

Thus to resolve I removed the brew install of mysql and I installed the 5.7.16 package from the mysql website. I can now connect to the server from mysql client and through the ruby driver without any errors

$ mysql -h <myserver> -u <myuser> -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.

A number of team members experinced the same problem and the issue was resolved when mysql was installed directly(i.e not using brew install)

MikeMcQuaid commented 7 years ago

Sorry but you have not followed the requested steps on the Troubleshooting page

Please follow (all of) these steps and post the information here so we can help you with your problem.

Thanks!

conorfi commented 7 years ago

Hello Mike, I went through the troubleshooting steps

run which mysql

which mysql
/usr/local/bin/mysql

attempt to connect

mysql -h <host>-u <user>-p
Enter password:
ERROR 2026 (HY000): SSL connection error: error:00000001:lib(0):func(0):reason(1)

Uninstall mysql

brew uninstall mysql
Uninstalling /usr/local/Cellar/mysql/5.7.16... (13,511 files, 439M)

brew update twice

brew update
Updated 2 taps (homebrew/core, homebrew/versions).
==> Updated Formulae
homebrew/versions/jenkins-lts            liblastfm                                rclone                                   sdl_image                                telegraf
==> Deleted Formulae
czmqpp
 ξ‚° ~ ξ‚° brew update
Already up-to-date.

brew doctor

brew doctor
Your system is ready to brew.

x-code command

xcode-select -p
/Library/Developer/CommandLineTools

brew install mysql and re-attempt to connect, same issue ERROR 2026 (HY000): SSL connection error: error:00000001:lib(0):func(0):reason(1)

brew-config

brew config
HOMEBREW_VERSION: 1.1.0
ORIGIN: https://github.com/Homebrew/brew
HEAD: b7abd33475b98598b414f9c4ee2e20249855437b
Last commit: 3 days ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 659d0c9891e1f047be52dc4f55826b61dfaaed37
Core tap last commit: 17 minutes ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_REPOSITORY: /usr/local/Homebrew
HOMEBREW_CELLAR: /usr/local/Cellar
HOMEBREW_BOTTLE_DOMAIN: https://homebrew.bintray.com
CPU: octa-core 64-bit haswell
Homebrew Ruby: 2.0.0-p648
GCC-4.2: build 5666
Clang: 7.3 build 703
Git: 2.10.1 => /usr/local/bin/git
Perl: /usr/bin/perl
Python: /usr/bin/python
Ruby: /Users/<user>/.rvm/rubies/ruby-2.3.1/bin/ruby
Java: 1.8.0_101
macOS: 10.11.6-x86_64
Xcode: N/A
CLT: 7.3.1.0.1.1461711523
X11: N/A

brew logs on gist

MikeMcQuaid commented 7 years ago

Can you connect to your local MySQL database? What version and OS is the remote server?

conorfi commented 7 years ago

OS version of remote server CentOS release 6.5 (Final)

local connection is possible Although i would just like to re-iterate that team members cannot connect to the remote sever when they use brew install of mysql, only when they use the package outside of brew.

mysql -h localhost -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 12
Server version: 5.7.16 Homebrew

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MikeMcQuaid commented 7 years ago

local connection is possible

If this is the case I'm not sure it's our bug. What's the version of OpenSSL/MySQL on the server?

conorfi commented 7 years ago

Monkey: Percona server 5.6.22 Note: I believe that Percona is compatible with mysql Open SSL: 1.0.1e-30

MikeMcQuaid commented 7 years ago

Can you try https://github.com/Homebrew/homebrew-versions/blob/master/percona-server56.rb and then https://github.com/Homebrew/homebrew-versions/blob/master/mysql56.rb? Thanks.

conorfi commented 7 years ago

Hi Mike, Are you requesting that i install these on the server? If so this would not be possible as i cannot make changes to the server

Conor

MikeMcQuaid commented 7 years ago

No, on your local system. They will help but I suspect the problem is with the configuration of your server, FYI.

conorfi commented 7 years ago

A collegue tried this solution on their system, they had the SQL connect issue. The 3 commands below solved the problem on their system.

brew uninstall mysql
brew install percona-server56
brew install mysql56
MikeMcQuaid commented 7 years ago

Ok. It seems you need to use a MySQL client that matches the server version.

conorfi commented 7 years ago

Thanks for your help