MySQL Utilities with MySQL 8 Server

Viewed 1393

As part of our build process, we use the mysqldiff utility (invoked from maven) to validate our database migration scripts by comparing a freshly-built copy of the schema to a version of the schema created from a baseline plus our migration script. This all works fine with MySQL 5.7.

We are looking to upgrade to MySQL 8.0.13. The database user has been configured to use mysql_native_password. When we run our build, we are getting this error from mysqldiff:

ERROR: Authentication plugin 'caching_sha2_password' is not supported

We understand that this error is due to the fact that the utility is using an old version of mysql-python-connector. We also understand that the answer might be as simple as upgrading the connector version, but we don't know how to go about trying that.

The MySQL Utilities can be found at https://github.com/mysql/mysql-utilities.

On Windows 10, we install using the Oracle windows installer. On Amazon Linux, we install with yum.

NOTE:

  1. The MySQL Utilities appear to be based on an embedded python2.7 installation (we do not have standalone python installed on any of the development or build machines).
  2. We do not have python expertise, so detailed steps will be helpful if we are mucking with the embedded python stuff.
  3. We need to solve this problem both on Windows 10 and Amazon Linux.

How do we work around this error so that we can use mysqldiff with a MySQL 8.0.13 server on Windows 10 and Amazon Linux?

If the answer is simply to upgrade the connector, what are the detailed steps for doing that?

Are there server installation/configuration changes we can make to support clients connecting with old drivers?

2 Answers

I have managed to run mysqldiff.py against mysql 8, with some patches:

clone the patched source code and enter its dir:

$ git clone https://github.com/georgexsh/mysql-utilities.git

create a virtualenv and activate it:

$ virtualenv -p python2 venv
$ . venv/bin/activate

install the newer mysql connector:

(venv) $ pip install mysql-connector-python>=8.0

install mysql-utilities to the current virtualenv:

(venv) $ pip install .

now mysqldiff.py is able to run. if you want to run without activate virtualenv, you use its full path:

/path/to/mysql-utilities/venv/bin/mysqldiff.py

steps under windows are mostly the same, except virtualenv activation:

venv\Scripts\activate.bat

I encountered same problem and looked into mysql python connector code and added class for caching_sha2_password. It works for me now.

1. To fix the issue download source code for mysql-python-connector from Mysql official website, then install python (any version).

2. unzip downloaded mysql-python-connector zip file, and inside you will find setup.py

3. Open terminal and type python setup.py install

4. build folder will be created in current folder. Go to build/mysql/ and copy authentication.py file

5. open Mysql Utilities ->> bin ->> library.zip, and find mysql connector- > mysql > authentication.pyc file and delete i and paste authentication.py file you copied earlier.

6. DONE !

If you dont want to mess with it, you can download ready files from this link

Here is the link for files and explanation.

https://github.com/rgaraisayev/mysqldiff

Related