Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I convert MySQL database to SQLite in PHP?

Tags:

php

sqlite

mysql

I need PHP code to convert the database. I tried How to convert mysql to SQLite using PHP but it dint have answer

like image 897
Aakash Gupta Avatar asked Sep 21 '12 08:09

Aakash Gupta


People also ask

How to convert SQLite to MySQL?

The quickest and easiest way to convert SQLite to MySQL is by exporting an SQL Database to a Dump File, and then importing the SQLite Dump into MySQL Database. You can export an SQLite Database to Dump File using the .dump command. Now, import this Dump File into MySQL using the command shown below.

How do I convert a rebasedata database to SQLite?

Download the RebaseData client Java tool . To convert your database using RebaseData, run the following command: Replace file.sql with the path to the MySQL .SQL file you want to convert. The file output.zip will contain a .SQLITE file with your data or the error message if something went wrong.

How to modify the CREATE TABLE statement in SQLite?

This modified CREATE TABLE statement will work successfully in SQLite. Open a terminal window. This will open the sqlite command line program and simultaneously open the database file. If the database file doesn't exist, it will create it. Note errors, if any, and modify source .sql file to eliminate errors.

What is SQLite?

SQLite is an open-source Relational Database Management System (RDBMS). Most of the Relational Databases are based on the Client-Server model, which means that the Database typically runs on a server. However, SQLite is a Serverless Relational Database Management System, also referred to as an Embedded Database.


2 Answers

I finally found its solution. Save sh file available at https://gist.github.com/943776 and execute "./mysql2sqlite.sh DBNAME --databases DBNAME -u DB_USERNAME -pDB_PASSWORD | sqlite3 database.sqlite"(without qoutes and with "`") in php file. Save both files in one folder

like image 197
Aakash Gupta Avatar answered Sep 22 '22 02:09

Aakash Gupta


Go to phpmyadmin click export database download as sql file.

Download it....

go to your sql lite management software import the .sql file

done...

like image 21
Tschallacka Avatar answered Sep 21 '22 02:09

Tschallacka