将 Django DB 从 SQLite 迁移到 MySQL 的最佳方法是什么?

2021-11-20 00:00:00 django database migration mysql sqlite

我需要将我的数据库从 sqlite 迁移到 mysql,而且各种工具/脚本太多了,我无法轻松找到最安全、最优雅的解决方案.

I need to migrate my db from sqlite to mysql, and the various tools/scripts out there are too many for me to easily spot the safest and most elegant solution.

在我看来这很好 http://djangosnippets.org/snippets/14/ 但似乎距获得令人担忧的更新已经过去了 3 年..

This seemed to me nice http://djangosnippets.org/snippets/14/ but appears to be 3 years since getting an update which is worrying..

你能推荐一个已知在 Django 1.1.1 中可靠的解决方案吗?

Can you recommend a solution that is known to be reliable with Django 1.1.1 ?

推荐答案

执行:

python manage.py dumpdata > datadump.json

接下来,将您的 settings.py 更改为 mysql 数据库.

Next, change your settings.py to the mysql database.

最后:

python manage.py loaddata datadump.json

相关文章