• Hey Guest, we're evolving the future of TeaSpeak.
    You're invited to join the discussion here!

Server SQLite3 to MariaDB / MySQL

BIOS

TeaSpeak Team
Staff member
TeaTeam
I wanted to do this since I preferred to have my databases in one place, I wanted to move the TS 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.

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 10 and MariaDB 10.5 You may need to install sqlite3, perl and libmariadb2:

Code:
apt-get install sqlite3 perl libmariadb2
Anyway, here is the way to convert your Teaspeak 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 teaspeak service down:
    Code:
    systemctl stop teaspeak
  • Create a new database and user for your TS 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 TS directory containing TeaData.sqlite. For example, my TS is located in
    Code:
    cd /home/teaspeaks
  • Backup first, then dump the database from SQLite:
    Code:
    cp TeaData.sqlite TeaData.sqlite.bak
    Code:
    sqlite3 TeaData.sqlite .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
  • 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
FAQ

Q: Can i run teaspeak with multiple Database servers?

A: No you cant connect with multiple Database servers

Q: Can i connect multiple Teaspeak servers with the same Database server?
A: yes it is possible to use several teaspeak servers with the same database server, only the teaspeak servers must all have the same version. Also note that all servers then use the same ports and database tables so you should define different port ranges.

Q: Can i only host the Database server on the local machine?
A: You can host the Database on all machines thats can connect over the Internet.

Q: Will the Database automatic upgrading / updating the database if i update the server software?
A: Yes it will automatic do it

Q: Need i create and manage Database tables?
A: No its not needed to create and manage Database tables.

Q: Is the .bak file ready for the productions mode again?
A: Since the file can still be used for the production mode, however, it is then not up to date.

Info

In the next guide i will show you how to create bakups for the whole instance (not every virtual server).