MySQL配置不当原因:不安全使用相对路径 [英] MySQL Improperly Configured Reason: unsafe use of relative path

查看:445
本文介绍了MySQL配置不当原因:不安全使用相对路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Django,当我运行 python manage.py runserver 我收到以下错误:

I'm using Django, and when I run python manage.py runserver I receive the following error:

ImproperlyConfigured: Error loading MySQLdb module: dlopen(/Library/Python/2.7/site-packages/_mysql.so, 2): Library not loaded: libmysqlclient.18.dylib
  Referenced from: /Library/Python/2.7/site-packages/_mysql.so
  Reason: unsafe use of relative rpath libmysqlclient.18.dylib in /Library/Python/2.7/site-packages/_mysql.so with restricted binary

我不完全确定如何解决这个问题。我已经通过pip安装了MySQL-python。而且我之前提到了这个步骤。

I'm not entirely sure how to fix this. I have installed MySQL-python via pip. And I followed this step earlier.

我还要指出这是El Capitan Beta 3。

I want to also point out this is with El Capitan Beta 3.

推荐答案

在OS X El Capitan(10.11)中,Apple添加了系统完整性保护

In OS X El Capitan (10.11), Apple added System Integrity Protection.

这样可以防止在 / usr 之类的受保护位置的程序调用共享库,该共享库使用另一个共享库图书馆。在 _mysql.so 的情况下,它包含对共享库 libmysqlclient.18.dylib 的相对引用。

This prevents programs in protected locations like /usr from calling a shared library that uses a relative reference to another shared library. In the case of _mysql.so, it contains a relative reference to the shared library libmysqlclient.18.dylib.

将来可能会更新共享库 _mysql.so 。在此之前,您可以强制它通过 install_name_tool 实用程序使用绝对引用。

In the future, the shared library _mysql.so may be updated. Until then, you can force it to use an absolute reference via the install_name_tool utility.

假设 libmysqlclient.18.dylib 在/ usr / local / mysql / lib /中,然后运行命令:

Assuming that libmysqlclient.18.dylib is in /usr/local/mysql/lib/, then run the command:

sudo install_name_tool -change libmysqlclient.18.dylib \
  /usr/local/mysql/lib/libmysqlclient.18.dylib \
  /Library/Python/2.7/site-packages/_mysql.so

这篇关于MySQL配置不当原因:不安全使用相对路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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