用MySQL设置Django,syncdb给出分段错误? [英] Setting up Django with MySQL, syncdb giving segmentation fault?

查看:59
本文介绍了用MySQL设置Django,syncdb给出分段错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在构建Django应用.我正在遵循"tangowithdjango" 教程,该教程使用Django 1.54.在他们的教程中,他们使用Sql-lite,但是我正计划出于最可靠的目的构建此应用程序,这就是为什么我尝试连接MySQL的原因.

I'm currently working on building a Django app. I'm following the "tangowithdjango" tutorial, which uses Django 1.54. In their tutorial, they use Sql-lite, but I'm planning on building this app for most robust purpose, which is why I'm attempting to connect MySQL instead.

不用说,这是一场噩梦.我无法终生连接MySQL.

Needless to say, it's been a nightmare. I can't get MySQL to connect for the life of me.

这是我的settings.py的样子:

Here's what my settings.py looks like:

DATABASE_PATH = os.path.join(PROJECT_PATH, 'app.db')

DATABASES = {
'default': {
    'ENGINE': 'django.db.backends.mysql',
    'NAME': 'rideb',
    'USER': 'root',
    'PASSWORD': 'nantucket',
    #'HOST': 'localhost',             # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP.
    #'PORT': '',                      # Set to empty string for default.
    }
}

这是我得到的输出...

And here's my output I'm getting...

(rideb)grantmcgovern@gMAC:~/Dropbox/Developer/Projects/RideB/master$ python manage.py syncdb
Segmentation fault: 11

我已经安装了python-mysqldb,现在我已经很明白了,至少可以说我很困惑.这是一些Django兼容性问题吗?

I've installed python-mysqldb, and now I'm simply getting this, and I'm very perplexed to say the least. Is it some Django compatibility issue?

一切都很好,如本教程所建议的使用SQL-lite,但并不打算使用它.

Everything works fine as the tutorial suggests with SQL-lite, but not looking to use that.

操作系统:

Mac OSX 10.10优胜美地

Mac OSX 10.10 Yosemite

MySQL(通过.dmg安装在Oracle网站上)

MySQL (installed via .dmg on Oracle's site):

Server version: 5.6.19 MySQL Community Server (GPL)

推荐答案

我遇到了类似的问题,事实证明这与Mac(OS X 10.10 Yosemite)上的不正确的mysql实现有关.我安装了"mysql-connector-c"而不是"mysql".卸载"mysql-connector-c"(简要卸载mysql-connector-c)并安装"mysql"(简要安装mysql)即可解决此问题.

I had a similar problem and it turns out it was related to incorrect mysql implementation on my Mac (OS X 10.10 Yosemite). I had "mysql-connector-c" installed instead of "mysql". Uninstalling "mysql-connector-c" (brew uninstall mysql-connector-c) and installing "mysql" (brew install mysql) resolved the problem right away.

要确定您是否像我一样正遇到此确切问题,请在Mac上打开Console应用程序,转到用户诊断报告"并查找崩溃报告(应以Python_开头).在队列下,如果显示"0 libmysqlclient.18.dylib",那么您将遇到与我相同的问题.

To find out if you are facing this exact problem as I did, open the Console app on your Mac, go to User Diagnostic Reports and look for the report for your crash (should start with Python_). Under queue, if it shows you "0 libmysqlclient.18.dylib", then you have the same problem as I had.

这篇关于用MySQL设置Django,syncdb给出分段错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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