Mike Johnson Jr
Mike Johnson Jr

Reputation: 796

How can I switch my Django project's database engine from Sqlite to MySQL?

I need help switching my database engine from sqlite to mysql. manage.py datadump is returning the same error that pops up when I try to do anything else with manage.py : ImproperlyConfigured: Error loading MySQL module, No module named MySQLdb.

This django project is a team project. I pulled new changes from bitbucket and our backend has a new configuration. This new configuration needs mysql (and not sqlite) to work. Our lead dev is sleeping right now. I need help so I can get started working again.

Edit: How will I get the data in the sqlite database file into the new MySQL Database?

Upvotes: 1

Views: 5106

Answers (2)

karol
karol

Reputation: 430

Try the followings steps: 1. Change DATABASES in settings.py to MYSQL engine 2. Run $ ./manage.py syncdb

Upvotes: -1

alecxe
alecxe

Reputation: 473763

According to the Database setup paragraph in Django docs:

By default, the configuration uses SQLite.

If you wish to use another database, install the appropriate database bindings...

And Get your database running page says:

If you’re using MySQL, you’ll need the MySQL-python package, version 1.2.1p2 or higher.

To use MySQL backend you need a tool that would help Django talk to the database, an adapter.

In other words, MySQL-python (aka MySQLdb) package needs to be installed.

Upvotes: 3

Related Questions