How to convert .db file to .sql file

28,852

Solution 1

You can try Valentina Studio (license is free, crashes far less than MesaSQLite)

Steps:

  1. Open the .db file in Valentina Studio
  2. Select a table in schema editor
  3. Right/Alternate click the table name
  4. Generate SQL
  5. Show Create

And in a new editor tab that appears, you will have a sql create statement you can use for your mysql server. Note: Depending on the complexity of your table you may need to apply corrected syntax for it to work in mysql.

If you need to copy the rows contained in your selected table you can create a dump (from right click on table) and then import.

Solution 2

There is simple sqlite command:

sqlite3 database.sqlite3 .dump >> database.sql

Note the dot before "dump". This is special command to sqlite3 cli client eg. dot-commands.

For Ubuntu, sqlite3 can be installed by:

apt-get install sqlite3
Share:
28,852

Related videos on Youtube

user3317477
Author by

user3317477

Updated on September 23, 2020

Comments

  • user3317477
    user3317477 over 3 years

    I have mydatabase.db file and I want it to be conveted to mydatabase.sql file.

    How to do this?. Thank you.

    Is there any sqlite command?. or any software to convert this, or any mysql command?.

  • Vitor Mazuco
    Vitor Mazuco about 2 years
    yes, worked for me