mysql error 2049 connection using old (pre-4-1-1) authentication from mac

江枫思渺然 提交于 2019-12-11 01:53:00

问题


I have been performing a mysql migration from 4.0.24 to 5.6.12 and was actually done with a python script to transfer the data when a lovely update to mysql broke my authentication to the old server.

I am using a mac os x 10.8.5. previous versions of mysql via brew were 5.5.27, 5.5.28, 5.5.29, & 5.6.12. I had issues with a previous use permissions and ended up blowing all those away (after making a copy of /usr/local). Now all I have is mysql 5.6.13... I was able to re-install 5.6.12 via commit, but the 5.5.* versions(files) are no longer available via mysql.com through brew.

So the error I am getting is this:

machine:folder user$ python migrate.py
Traceback (most recent call last):
......
    return DBH( params )
  File "dbh.py", line 32, in __init__
    db=self.params.get('db')
  File "/Volumes/Data/Users/user/.virtualenvs/migrate/lib/python2.7/site-packages/MySQLdb/__init__.py", line 81, in Connect
    return Connection(*args, **kwargs)
  File "/Volumes/Data/Users/user/.virtualenvs/migrate/lib/python2.7/site-packages/MySQLdb/connections.py", line 187, in __init__
    super(Connection, self).__init__(*args, **kwargs2)
_mysql_exceptions.OperationalError: (2049, "Connection using old (pre-4.1.1) authentication protocol refused (client option 'secure_auth' enabled)")

Keep in mind I did install mysql-python via pip; and have tried both 1.2.3 and 1.2.4 (no other version available)

and I am using virtualenvwrapper with site packages included... also tried to use pip with different versions over mysql-python

I am not that familiar with the mac OS yet, so i am not exactly sure how one of these packages exactly plays off of each other... my best guess is that brew install mysql is both the server and client libraries, and services; and that the local pip install mysql-python only extends off of the brew install... then the virtualenv would overwrite the local mysql-python install. If this is incorrect please let me know and explain if possible, might help me out too.

I did find the following links, but ultimately did not help:

  • mysql-error-1064 (this looked like it was heading in the right direction, but did not explain how to implement it specifically.

any clues? Thank you very much in advance.


回答1:


Versions of MySQL since 5.6.7 have secure_auth enabled by default, which means that a 5.6.7+ client won't allow you to connect if your MySQL user password is hashed using the pre-4.1 method. You said you are migrating from a 4.0.24 installation, so your MySQL user password is definitely hashed using the pre-4.1 method.

When using the mysql command-line tool, you can get around this and connect to your pre-4.1 database by using the --skip-secure-auth command line option. For example:

mysql -h 127.0.0.1 -u username -p --skip-secure-auth

Unfortunately there's no way to disable secure_auth in mysql-python.



来源:https://stackoverflow.com/questions/18239699/mysql-error-2049-connection-using-old-pre-4-1-1-authentication-from-mac

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!