On the server
Install mysql server, this will ask you to create a password, remember it and keep it safe!
sudo apt-get install mysql-server
Log in to mysql and add the user kodi and give it relevant permissions:
mysql -u root -p CREATE USER 'osmc'@'%' IDENTIFIED BY 'osmc’; GRANT ALL PRIVILEGES on *.* TO 'osmc'@'%' WITH GRANT OPTION; FLUSH PRIVILEGES; \q
Edit the mysql config file to allow access from other devices:
sudo vim /etc/mysql/my.cnf
Fine the line starting ‘bind-address’ and change it to the below, this will allow access from more than localhost
bind-address = 0.0.0.0
Restart the mysql server:
sudo service mysql restart
All done on the server!
On the client(s)
Paste this after replacing XXX.XXX.XXX.XXX with the IP address of the server that you’ve installed mysql-server on:
Press ctrl + x to save the file.
If this is a second client being connected to the mysql server copy the sources.xml file over, on the client that’s already setup:
scp ~/.kodi/userdata/sources.xml osmc@XXX.XXX.XXX.XXX:~/.kodi/userdata/
Where XXX.XXX.XXX.XXX is the IP address of the device you have just setup to connect to the mysql server.