Here’s a quick way to export SQLite3 database to *.sql text file.
sqlite3 this.db .dump > this-db.sql
The command is useful for exporting SQLite database to standard ANSI .sql which can be imported into other database management system such as Oracle, MariaDB/MySQL, etc
Here’s a short guide on how to convert between sqlite2 to sqlite3 database file:
sqlite2 /path/to/mysqlite2.db .dump > backupfile
sqlite3 /path/to/mynewsqlite3.db < backupfile
Using the same method, you can convert sqlite3 db to sqlite2 db too!
p/s: Why you need to convert? because embedded device (read: iPhone and Android) only supports sqlite3 database, while PHP 5 by default supports sqlite2 database.
Thus, this method provide a convenient way to convert between the two different version of sqlite db format.
This tip would be useful for those who are either making backup of their remote mysql database or moving their web hosting to their provider.
Here’s how to export mysql DB to SQL file using command-line utility :
mysqldump –user=username –password=1234 –databases your_database –opt –quote-names –complete-insert > example.sql
Here’s how to import the SQL back into mysql database :
mysql –user=username –password=1234 –databases your_database –host=mysql_server host
Don’t forget to add your ip address to the list of allowable host on the remote MySQL server!
I guess you all have heard the news now. Sun Microsystem is going to acquire MySQL AB, the company behind the most popular open source database server, MySQL anytime soon.
After this acquisition, Sun would control the Java platform, JavaME embedded programming platform, SunOS/Solaris operating system, workstations, StarOffice suite, and now MySQL.
Seems appropriate to say “Everything under the Sun” now.