使用来自Mac的旧(4-1-1之前)身份验证的mysql错误2049连接 [英] mysql error 2049 connection using old (pre-4-1-1) authentication from mac

查看:68
本文介绍了使用来自Mac的旧(4-1-1之前)身份验证的mysql错误2049连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在执行从4.0.24到5.6.12的mysql迁移,实际上是通过python脚本完成的,以便在对mysql进行的可爱更新使我无法通过旧服务器的身份验证时传输数据.

我正在使用Mac OS X 10.8.5.通过brew的mysql先前版本是5.5.27、5.5.28、5.5.29和& 5.6.12.我在使用以前的权限时遇到了问题,最终把所有这些都扔掉了(在制作/usr/local的副本之后).现在我所拥有的只是mysql 5.6.13 ...我可以通过commit重新安装5.6.12,但是5.5.*版本(文件)不再可以通过brew通过mysql.com获得.

所以我得到的错误是:

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)")

请记住,我确实是通过pip安装mysql-python的;并且已经尝试了1.2.3和1.2.4(没有其他版本)

并且我正在使用包含站点包的virtualenvwrapper ...还尝试通过mysql-python在不同版本上使用pip

我还不太熟悉Mac OS,因此我不确定这些软件包中的一个如何相互配合...我最好的猜测是brew install mysql既是服务器库,又是客户端库,和服务;并且本地pip安装mysql-python仅扩展自brew安装...然后virtualenv将覆盖本地mysql-python安装.如果这是不正确的,请让我知道并解释,如果可能的话,也可能对我有帮助.

我确实找到了以下链接,但最终没有帮助:

有什么线索吗?提前非常感谢您.

解决方案

从5.6.7版开始的MySQL版本默认启用了secure_auth,这意味着如果您的5.6.7+客户端不允许您连接,使用4.1之前的方法对MySQL用户密码进行哈希处理.您说要从4.0.24安装进行迁移,因此肯定使用4.1之前的方法对MySQL用户密码进行哈希处理.

使用mysql命令行工具时,可以解决此问题,并使用--skip-secure-auth命令行选项连接到4.1之前的数据库.例如:

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

不幸的是,无法在mysql-python中禁用secure_auth.

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.

解决方案

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.

这篇关于使用来自Mac的旧(4-1-1之前)身份验证的mysql错误2049连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆