How to convert the exported *.sql file from SQLite to the file which can be recognized by MySQL?
Maybe the solution is not a perfect solution, but it is easy and really works for me.
1. Find a software to export the data from SQLite.
SQLite Manager - firefox plug-in
Sqliteman - Linux
2. Dump or Export them to a filename.sql
3. Open the filename.sql by text editor and you may see the similar content as following:
PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
CREATE TABLE [MYTABLE]
(
[mytable_id] INTEGER PRIMARY KEY AUTOINCREMENT,
[mytable_name] CHAR(255),
[name] VARCHAR(50),
[mytable_version] CHAR(255),
[mytable_version_float] FLOAT default 1,
[mytable_type] INTEGER(4) default 1,
[mytable_status] INTEGER(4) default 0,
[mytable_status_update] INTEGER(4) default 0,
[user_generated] INTEGER(4) default 0,
[icon] CHAR(255),
[icon_preview] CHAR(255),
[key] INTEGER(11) default 0,
[param] TEXT,
[createtime] TIMESTAMP,
[edittime] TIMESTAMP
);
4. Replace some marks and words.
[ => `
] => `
AUTOINCREMENT => AUTO_INCREMENT
boolean => tinyint(1)
5. Delete ALL the statements which has sqlite_sequence.
For instance,
DELETE FROM sqlite_sequence;
INSERT INTO `sqlite_sequence` VALUES('serverlist',1);
6. The remain sql is what you need.
留言列表