How To convert MySQL to SQLite

0 Comments
Editor Ratings:
User Ratings:
[Total: 1 Average: 5]




This tutorial explains how to convert MySQL to SQLite. Here I will talk about some easy methods to convert a MySQL database to SQLite database easily. In the following post, I will talk about three different methods that will convert a given MySQL database to SQLite. Basically the following methods use the database dump from MySQL database system to a SQLite database. And one of the method can directly convert any MySQL database to SQLite just after connecting to the MySQL server. I tried all the tools in this list on a database having 47 tables along with the data.

If you’ve been running MySQL database for so long and want to migrate to some cheaper database then you can consider migrating to SQLite. SQLite being the most used database in applications and tools has its own set of advantages. The best part is that it is a serverless database where you don’t have to set up a server on computer like MySQL. It work locally and uses local files to save and manage databases. There are some free SQLite editor software that you can use to open, view, and manage the databases.

There are some heavily paid tools available which help you migrate MySQL to SQLite. You can do that free of cost and I will show you how. Some of the following methods use the MySQL dump (SQL files) to create the final SQLite database (DB, DB3, SQLITE) files. While one of the methods in the below list can directly connect to MySQL database and clone it to a SQLite database.

convert MySQL to SQLite

How To convert MySQL to SQLite?

LazSqlX

LazSqlX is a free database browser that you can use to connect to different databases installed on your PC. You can use this software to connect to MySQL database and access all the data. And the best part is that, it comes with a built-in tool, “Database Cloner”. The database cloner tool of this software can clone a database system to another type of database system. And luckily, using that tool, you can easily clone any MySQL database as SQLite database. And it allows you to either clone only the schema or the whole database along with data. However, cloning database along with the data takes more time. And it completely depends on the number of tables and records in them.

The following steps will guide you how to use this software to convert MySQL database to SQLite.

Step 1: Open the software and then connect to the MySQL server instance running on your machine. Simply connect to the database by specifying the connection parameters like database name, username, server, and password.

LazSqlX connect to database

Step 2: After connecting to the MySQL database, simply open the database cloner from the Tools > Database Cloner menu. After that, specify the path to the final SQLite database file that will be created. Next, you can check the “Copy Data” option if you want to clone the data from the tables as well.

LazSqlX database cloner tool

Step 3: Now, simply start the cloning process and you can see the progress of the cloning. It will take time and depends on the amount of data to be cloned too. In the end, when it has completed the cloning process, you can use the SQLite database file that it has created. You can open the database file in any SQLite viewer or editor software.

LazSqlX database cloner tool migrating mysql database to sqlite

In this way, you can use Database Cloner tool of LazSqlX to convert MySQL database to SQLite. And it hardly takes a few minutes to do that. Just a few clicks are required to clone a database to SQLite. And the best part here is that you don’t have to rely on the SQL dump. Just connect to any MySQL database and painlessly convert it to SQLite.

mysql2sqlite

mysql2sqlite is actually a shell script that you can run on Linux as well as on Windows to convert an SQL dump of a MySQL database to SQlite database. This tool is primarily meant for Linux but you can use it on Windows via Cygwin. Cygwin is the Linux terminal for Windows that supports most of the Linux commands. And using this mysql2sqlite tool, you can convert a MySQL database to SQLite by just running a simple command.

These are the simple steps to use this script to convert any MySQL database to SQLite.

Step 1: Install Cygwin if you don’t already have it on Windows. And do note that, while installing, make sure that you can select the “sqlite3” package with it.

Step 2: Grab the mysql2sqlite’s GitHub repository from above link. After that, copy the “mysql2sqlite” file to some folder of your choice. And in the same folder, pace the SQL dump file that will be used to generate the SQLite database.

mysql2sqlite shell script plus sql dump file

Step 3: Now, open the Cygwin terminal and then run the following command. After running the command, it will create a SQLite database file in the same directory. After getting the SQLite file, you can do whatever you want.

./mysql2sqlite "sql dump file" | sqlite3 "SQLite database name"

mysql2sqlite in action via Cygwin in windows

In this way, you can use this simple script to easily convert a MySQL database to SQLite. And it is the fastest method in this list to do that. And no matter if you are on Linux computer or Windows, you can easily use this simple script to migrate a SQLite database to SQLite.

RebaseData

RebaseData free mysql to sqlite converter

RebaseData is actually an online tool to convert MySQL to SQLite for free. Here it simply takes the SQL dump file of the MySQL database that you want to convert to SQLite. You can simply upload the SQL file on the website and it will process it. And in a few seconds, it will return the SQLite database file that you can use anywhere you want. It extracts all the tables from the input SQL data dump and then precisely packs them in a functional SQLite database. And to convert a database on this website, you can either use the website’s online interface or you can use the API to do the same.

Go to the homepage of the website from above and then simply upload the SQL dump file from MySQL. After that, just leave the rest on this tool. It will process the file and when it has finished, you can download the final SQLite database file in a ZIP archive. However, the time taken to convert a SQL file from MySQL to SQLite depends on the size of the input.

Final thoughts

These are the best methods that will help you convert any MySQL database to SQLite database. All the methods are very handy and whenever you think of migrating your MySQL databases to SQLite then these methods will surely come in handy. So, if you are looking for some free software or tools to convert a MySQL database to SQLite then use any one from the above list. Also, if you know of some other different ways to do the same then do share with me.

Editor Ratings:
User Ratings:
[Total: 1 Average: 5]

Leave A Reply

 

Get 100 GB FREE

Provide details to get this offer