首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >将MySQL传输到SQLite

问将MySQL传输到SQLite
EN

Stack Overflow用户
提问于 2009-11-03 11:25:45
回答 7查看 11.1K关注 0票数 7

我想开始在现有的MySQL数据库中使用iPhone上的核心数据。将MySQL数据库转移到SQLite最简单的方法是什么?

我试过使用ODBC Migrator,但我不知道在哪里可以找到SQLite驱动程序(雪豹)。我找到了http://www.ch-werner.de/sqliteodbc/,它似乎有驱动程序,但它们是用于Power PC的。

如果有人能给我介绍一下,或者告诉我最好的工具是什么,我将不胜感激。

谢谢。

EN

回答 7

Stack Overflow用户

回答已采纳

发布于 2012-12-04 18:08:45

为了进行转换,我最终使用了ODBC from Actual Access。我想我把它和SQLite Migrator结合使用了。我从来不喜欢这种方式,尽管它总是很笨拙。价格也很昂贵,这两款软件最终的成本约为80美元。

如果让我再做一次,我会买SQLabs的SQLiteConverter。我使用他们的SQLite管理器,虽然它有很多接口问题,但对于数据库软件来说还不错。

http://www.sqlabs.net/sqliteconverter.php

票数 -1
EN

Stack Overflow用户

发布于 2009-11-06 06:45:29

也许最简单的方法是使用mysqldump将MySQL数据库中的原始SQL转储到一个文本文件中,然后使用sqlite3_exec()函数执行该SQL以填充SQLite数据库。

票数 6
EN

Stack Overflow用户

发布于 2009-11-03 13:02:00

你看过this Perl script吗?我还没有用过它--我只是快速搜索了一下mysql到sqlite的迁移,然后它就弹出来了。

编辑(在你回复我的评论后):

reverse direction is dealt with here。

如果你要重复这样做,如果数据结构发生了变化,也许你最好使用像Django这样的东西(尽管是以一种非常黑客的方式)。有了它,我会:

代码语言:javascript
复制
# This three lines are done once
django-admin.py startproject mymigrationproject
cd mymigrationproject
./manage.py startapp migration

# The following lines you repeat each time you want to migrate the data
edit settings.py and make the changes to connect to MySQL
./manage.py inspectdb > ./migration/models.py
edit ./migration/models.py to reorder tables (tables in which other tables depend on top)
mkdir fixtures
./manage.py dumpdata migration > ./fixtures/data.json
edit settings.py and make the changes to connect to SQLite
./manage.py syncdb
./manage.py loaddata ./fixtures.data.json
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/1665061

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档