[Wiki] Install and configure mysql server and clients

Thanks Kyblik, your instructions were the best I could find.

I’ve improved on them further by finding instructions on adding Apache, Python and phpmyadmin to administer the MySQL.

Install OSMC, add SSH & FTP servers

Make sure OSMC web server is not set to Port 80, change to 8080

sudo apt-get update
sudo apt-get dist-upgrade

sudo apt-get install apache2 -y (then browse to the Pi’s IP address to confirm)

sudo apt-get install php7.0 libapache2-mod-php7.0 -y
sudo apt-get install mysql-server php7.0-mysql -y

If not asked for a password for Mysql -
sudo mysql_secure_installation
Enter root password as ‘root’

sudo service apache2 restart

sudo mysql
create user ‘kodi’ identified by ‘kodi’; (this is the username I’ve historically used)
grant all on . to ‘kodi’;
flush privileges;
quit

sudo apt-get install python-mysqldb
sudo apt-get install phpmyadmin
select Apache 2 server, then say Yes to configure database with dbconfig-common
Enter root password

sudo nano /etc/apache2/apache2.conf
at the bottom add this line
Include /etc/phpmyadmin/apache.conf
Exit by Ctrl-X
sudo /etc/init.d/apache2 restart

Then check phpmyadmin is working by going to 192.168.1.xxx/phpmyadmin
login with kodi/kodi

sudo nano /etc/mysql/mariadb.conf.d/50-server.cnf
locate the line
bind-address = 127.0.0.1
and change the IP
bind-address = 0.0.0.0
Ctrl+X to exit, confirm you want to save the file

Restart the service
sudo service mysql restart

1 Like