Zeeshan Chaudhry
Zeeshan Chaudhry

Reputation: 862

Convert MYSQL to SQLITE Database for Android

I Have a database in ".Sql" format. I would like to convert this database to ".sqlite" format. As I have to use this 16MB database with my android Application.

I've searched on the internet but couldn't find the result I was expecting.

Upvotes: 1

Views: 5132

Answers (3)

elias
elias

Reputation: 161

Here are some software that will help you out with it. I've used the shell script and it works like a charm.

http://www.sqlite.org/cvstrac/wiki?p=ConverterTools

What I also did, which is a way around but also worked for me. If you have your database and phpmyadmin, go to the database in phpmyadmin, select every table then choose expoert. In the export type select Open Document Spreadsheet. In the options select "Put fields names in the first row" and save. Once saved, open the document in Open Office and save it as csv, them from your SQLite editor, choose import from CSV and select this CSV file. I am using SQLite Database Browser on Mac and I had no problem converting mysql that way.

Hope this helps

Upvotes: 1

georgiecasey
georgiecasey

Reputation: 23381

There's a fantastic Linux shell script on Gist that converts Mysql to an Sqlite3 file. You need both mysqldump and sqlite3 installed on your server. Worked great for all my Android apps.

Upvotes: 1

Barak
Barak

Reputation: 16393

MySQL is has more functions and features than SQLite, which makes it difficult to switch between them at times.

If your schema is simple enough (read: doesn't contain a lot of the features that SQLite doesn't have), you could dump it into an SQL file and try to import it into an SQLite DB.

There are also several attempts at converters... you can find a list here.

Upvotes: 2

Related Questions