What#39;s the best way to migrate a Django DB from SQLite to MySQL?(将 Django DB 从 SQLite 迁移到 MySQL 的最佳方法是什么?)
问题描述
我需要将我的数据库从 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
这篇关于将 Django DB 从 SQLite 迁移到 MySQL 的最佳方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:将 Django DB 从 SQLite 迁移到 MySQL 的最佳方法是什么?
基础教程推荐
- SQL:使用来自具有相同列名的两个表中的数据... 2021-01-01
- 需要 MySQL 5.1 中的抽象触发器来更新审计日志 2021-01-01
- 将 SQL Server DateTime 列迁移到 DateTimeOffset 2021-01-01
- SSMS 中的权限问题:“对象 'extended_properties'、数据库 'mssqlsystem_resource'、... 错误 229)上的 SELECT 权限被拒绝" 2022-01-01
- 在 SQL 中连接多个表 2021-01-01
- SQL 效率:WHERE IN 子查询 vs. JOIN 然后 GROUP 2021-01-01
- 无法解决整理冲突 2021-01-01
- 是否可以执行按位分组功能? 2021-01-01
- SQL Server 实例在登录协商期间返回无效或不受支持的协议版本 2021-01-01
- 如何使用 mysql.connector 禁用查询缓存 2022-01-01
