Converting CoreProtect database from SQLite to MySQL

Shi-Ken Don
1 min readJun 27, 2017

--

A MySQL server on Google Cloud Platform

Environment

  • Minecraft Server 1.12
  • CoreProtect 2.14.2
  • MySQL 5.7

Workflow

  1. Export database.db to database.sql
  2. Fix columns of generated database.sql
  3. Create an empty MySQL database
  4. Launch a Minecraft server and connected to the MySQL database
  5. Stop the Minecraft server
  6. Import database.sql to MySQL
  7. Restart the Minecraft server and check with /co i command

Getting start

The most hard part is how to fix those .sql files in order to match MySQL columns. I wrote a script to do step 1 and 2 automatically.

Usage: ./create-migrations.sh database.db

It generates a database.sql in working directory. Then you can import this file to MySQL table directly.

P.S. This script is written for macOS and did not tested on other OS like Windows or Linux.

Conclusion

It took me 10 hours for importing a 1GB database.sql to the MySQL server (1 vCPU, 614.4 MB RAM).

References

Converting CoreProtect database from sqlite to MySQL?:admincraft
Import of Flat File to MySQL #212

--

--

Shi-Ken Don
Shi-Ken Don

Written by Shi-Ken Don

Software Engineer from Taiwan

Responses (3)