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 Ubuntu 16.04.1 and MariaDB 10.1. You may need to install sqlite3, perl and libmariadb2:
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:
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
- Backup first, then dump the database from SQLite:
cp ts3server.sqlitedb ts3server.sqlitedb.bak sqlite3 ts3server.sqlitedb .dump > MyDBName.sqlite.sql
- Download the script from GitHub:
- Now, make it executable run the perl file like so:
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:
mysql -u root -p MyDBName < MyDBName.mariadb.sql
FOR MARIADB ONLY:
- Change into the sql/updates_and_fixes directory inside your TS3 server folder:
- Import these two SQL files to the database you just imported, one after the other has finished:
mysql -u root -p MyDBName < convert_mysql_to_mariadb.sql mysql -u root -p MyDBName < mariadb_fix_latin_utf8.sql
Now, you must set up Teamspeak 3:
- Change back into the TS3 directory, open ts3server.ini, and edit the following lines accordingly:
dbplugin=ts3db_mariadb dbpluginparameter=ts3db_mariadb.ini dbsqlpath=sql/ dbsqlcreatepath=create_mariadb/ dbconnections=10
- Now create a new file corresponding to the file name of dbpluginparameter you specified in ts3server.ini and paste into it (I recommend using the first example, and using named sockets instead of port numbers):
[config] username='YOUR USER' password='YOUR PASSWORD' database='YOUR DATABASE' socket='/var/run/mysqld/mysqld.sock'
[config] server='localhost' port='3306' username='YOUR USER' password='YOUR PASSWORD' database='YOUR DATABASE'
- Finally, edit your startup script for TS3, so that it reads from ts3server.ini by adding the following as a parameter:
For example, my /etc/systemd/system/teamspeak.service looks like this:
[Unit] Description=Teamspeak 3 After=mysqld.service [Service] Type=forking User=teamspeak Group=teamspeak UMask=0027 Restart=always WorkingDirectory=/opt/ts3 PIDFile=/opt/ts3/ts3server.pid ExecStart=/opt/ts3/ts3server_startscript.sh start inifile=/opt/ts3/ts3server.ini ExecStop=/opt/ts3/ts3server_startscript.sh stop ExecReload=/opt/ts3/ts3server_startscript.sh restart [Install] WantedBy=multi-user.target
And if you’re using JTS3 Server Mod, here’s a daemon you can use:
[Unit] Description=JTS3 Server Mod daemon After=teamspeak.service systemd-networkd-wait-online.service [Service] Type=forking User=teamspeak Group=teamspeak Umask=0027 RestartSec=10 Restart=always WorkingDirectory=/opt/ts3/bot PIDFile=/opt/ts3/bot/jts3servermod.pid ExecStart=/opt/ts3/bot/jts3servermod_startscript.sh start ExecStop=/opt/ts3/bot/jts3servermod_startscript.sh stop ExecReload=/opt/ts3/bot/jts3servermod_startscript.sh restart [Install] WantedBy=multi-user.target