Migrate from SQLite / SQLAlchemy DB to a managed MySQL DB


I created my first web app using the 1-click web app. I am using Flask and SQLAlchemy. Right now my db is the SQLite file. The problem I am having is, that user can write to the db via the website, but I have no way of accessing /managing this data. So I want to move to a managed MySQL database.

Has someone done something like this before, could help me or send me in the right direction.

Any help greatly appreciated!

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
April 1, 2023

Hi there,

Yes, I believe that this should be doable. You can start by first exporting your SQLite data to a SQL file using the sqlite3 CLI:

sqlite3 your_sqlite_db.db .dump > sqlite_data.sql

Then once you have your data, you can convert SQLite SQL to MySQL compatible SQL: There are some differences in SQL syntax between SQLite and MySQL. You can use this Python package here for example:


To install the package run:

pip install sqlite3-to-mysql

Then, run the conversion:

sqlite3mysql -f sqlite_data.sql -o mysql_data.sql

Finally, you can import the converted file to your MySQL database using the mysql CLI client as described in the docs here:

Let me know if you hit any problems!



Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

card icon
Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Sign up
card icon
Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We’d like to help.

Learn more
card icon
Become a contributor

You get paid; we donate to tech nonprofits.

Learn more
Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow – whether you’re running one virtual machine or ten thousand.

Learn more ->
DigitalOcean Cloud Control Panel