Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting up Django with MySQL, syncdb giving segmentation fault?

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.

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

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

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?

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

OS:

Mac OSX 10.10 Yosemite

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

Server version: 5.6.19 MySQL Community Server (GPL)
like image 275
carbon_ghost Avatar asked Dec 11 '14 20:12

carbon_ghost


1 Answers

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.

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.

like image 113
Sarang Avatar answered Oct 21 '22 20:10

Sarang