on March 24, 2018. in Software, Development. A 1 minute read.
I’ve used recently PHPDocker.io to generate a set of Docker files for a pet project and it had the option to use MySQL 8 and of course I went with that. The problem was when I wanted to connect to the database that was on this MySQL 8 server.
I had locally installed the MySQL 5.7 client version and when trying to connect to the MySQL 8 server it complained about a missing authentication plugin:
ERROR 2059 (HY000): Authentication plugin 'caching_sha2_password' cannot be loaded:
/usr/lib64/mysql/plugin/caching_sha2_password.so: cannot open shared object file: No such file or directory
Turns out, in MySQL 8 this caching_sha2_password
is the default authentication plugin instead of the mysql_native_password
. This new authentication plugin is described in the documentation. I didn’t want to change anything in the MySQL docker image, so instead I decided to upgrade to MySQL 8 client on my Fedora. First I removed all traces of MySQL I had:
sudo dnf remove mysql
Then I installed the RPM from MySQL:
sudo dnf install https://dev.mysql.com/get/mysql57-community-release-fc27-10.noarch.rpm
And finally installed the MySQL 8 client:
sudo dnf --enablerepo=mysql80-community install mysql-community-client
And now I can connect to the MySQL 8 server inside the Docker container:
mysql -P 8082 -h 127.0.0.1 --protocol=tcp -utest -p test
Happy hackin’!
Tags: mysql, authentication.