Tutorial SQLite3 to MariaDB / MySQL

BIOS

Knowledge Seeker
VIP
Joined
Oct 10, 2015
Messages
447
Reaction score
848
Points
208
I wanted to do this since I preferred to have my databases in one place, I wanted to move the TS3 server I run to MariaDB. I ran into several struggles, such as converting the database into a format which could be read by MySQL and MariaDB. Since Teamspeak stopped supporting MySQL, you should probably switch to MariaDB.

I found a script that helped me do this, but it didn’t completely fix the problems. So I fixed that.

For this guide, I used Debian 9.2 and MariaDB 10.1.26 You may need to install sqlite3, perl and libmariadb2:

Code:
apt-get install sqlite3 perl libmariadb2
Anyway, here is the way to convert your Teamspeak 3 server from SQLite to MariaDB or MySQL. The perl script in this guide can be used for other SQLite conversions.

Exporting and preparing the database:



    • You need to SSH into the machine and do a dump of the SQLite database, so shut the teamspeak service down:
      Code:
      systemctl stop teamspeak
    • Create a new database and user for your TS3 server. it is recommended you create one which has a database in its own name which it has full privileges of. phpMyAdmin can help you with this.
    • Change into the TS3 directory containing ts3server.sqlitedb. For example, my TS3 is located in
      Code:
      cd /opt/ts3
    • Backup first, then dump the database from SQLite:
      Code:
      cp ts3server.sqlitedb ts3server.sqlitedb.bak
      Code:
      sqlite3 ts3server.sqlitedb .dump > MyDBName.sqlite.sql
    • Download the script from GitHub:
      Code:
      wget https://raw.githubusercontent.com/NotoriousPyro/SQLite-to-MariaDB-MySQL-perl-script/master/sqlite-to-mariadb.pl
    • Now, make it executable run the perl file like so:
      Code:
      chmod +x sqlite-to-mariadb.pl
      perl sqlite-to-mariadb.pl MyDBName.sqlite.sql > MyDBName.mariadb.sql
      1. You now should have (as long as there were no errors) a MariaDB / MySQL-compatible SQL file! Import it into your MySQL / MariaDB server:
        Code:
        mysql -u root -p MyDBName < MyDBName.mariadb.sql
      FOR MARIADB ONLY:
      1. Change into the sql/updates_and_fixes directory inside your TS3 server folder:
        Code:
        cd sql/updates_and_fixes
      2. Import these two SQL files to the database you just imported, one after the other has finished:
        Code:
        mysql -u root -p MyDBName < convert_mysql_to_mariadb.sql
        Code:
        mysql -u root -p MyDBName < mariadb_fix_latin_utf8.sql
For the next steps Configuring Teamspeak and Autostart look here:
https://r4p3.net/threads/scripts-for-ts3-server-mariadb-autostart.5696/
 

tagKnife

Well-Known Member
Joined
Oct 2, 2015
Messages
343
Reaction score
270
Points
146
why you using a dead language like perl... Just use PDO its interconnected with many database drivers.
 

BIOS

Knowledge Seeker
VIP
Joined
Oct 10, 2015
Messages
447
Reaction score
848
Points
208
is not my my convert file i said: "I found a script that helped me do this, but it didn’t completely fix the problems. So I fixed that." and the converter has nothing to do with database connection.
 
Top