MySQL/Setting up MySQL: Difference between revisions
< MySQL
Jump to navigation
Jump to search
No edit summary |
m (remove misleading unnecessary quotes) |
||
(5 intermediate revisions by 3 users not shown) | |||
Line 252: | Line 252: | ||
'''Mariadb in Docker Container:''' | '''Mariadb in Docker Container:''' | ||
If you are new to Docker, first install Docker for your specific OS. Containers are OS independent | If you are new to Docker, first install Docker for your specific OS. Containers are OS independent - see https://www.docker.com/ for more general information about Docker. | ||
https://www.docker.com/ | |||
If you don't have one already, create a docker-compose.yaml file. | |||
Here's an example service definition for a mariadb container using the offical MariaDB LTS (Long Term Support) image: | |||
services: | services: | ||
mariadb: | mariadb: | ||
image: mariadb: | image: mariadb:lts | ||
container_name: mariadb | container_name: mariadb | ||
ports: | ports: | ||
- 3306:3306 | - 3306:3306 | ||
volumes: | volumes: | ||
- | - /your/host/path/to/database/files/:/var/lib/mysql | ||
- / | - /your/host/path/to/mariadb/configuration/files:/config | ||
environment: | environment: | ||
- MYSQL_ROOT_PASSWORD=YOUR_MARIADB_ROOT_PASSWORD | |||
- MYSQL_ROOT_PASSWORD= | |||
- MYSQL_PASSWORD=kodi | - MYSQL_PASSWORD=kodi | ||
- MYSQL_USER=kodi | - MYSQL_USER=kodi | ||
- MARIADB_AUTO_UPGRADE | - MARIADB_AUTO_UPGRADE= | ||
restart: unless-stopped | restart: unless-stopped | ||
To bring the new container up, (in folder where docker-compose.yaml is located): | |||
<code>sudo docker compose up -d</code> | <code>sudo docker compose up -d mariadb</code> | ||
This will create a root user with the password you gave in the Docker Compose file. It will also create a user called "kodi" (please note that you can use any username you want - default is usually "kodi" with a password of "kodi"). The kodi user will NOT have appropriate access until you grant the correct privileges. | |||
So, with the container running: | |||
<code>sudo docker exec -it mariadb | <code>sudo docker exec -it mariadb bash</code> (to access a shell inside the container). | ||
Then, in that shell, run: | |||
<code>mariadb -u root -p</code> (enter root password from Docker Compose file) | <code>mariadb -u root -p</code> (enter root password from Docker Compose file) | ||
Line 298: | Line 293: | ||
<code>FLUSH PRIVILEGES;</code> | <code>FLUSH PRIVILEGES;</code> | ||
Then you can exit the mariadb shell. | |||
=Restricting MySQL access rights= | =Restricting MySQL access rights= |
Latest revision as of 03:54, 31 July 2025
Share libraries w/MySQL, guide: |
![]() |
![]() |
![]() |
You'll need to choose which of your computers, Kodi devices, or NAS will be the MySQL server. The server needs to be on 24/7 or have wake-on-lan (preferably the former), and needs to have a local static IP. You will probably want the Kodi device that is hosting most or all of your videos and music to also be the MySQL server, but this is not required.
Please Note: Do not manually create the MySQL/MariaDB databases on your database server. Set up the MySQL/MariaDB server, and Kodi will create the specific databases for you.
Also: Some versions of MySQL set their passwords to expire by default, even the root password! If the password expires, Kodi cannot access the database and the TV Series and Movies libraries will disappear.
To avoid this and/or fix it after it happens, make sure the account's password does not expire. (See: https://dev.mysql.com/doc/refman/5.7/en/password-management.html )
To avoid this and/or fix it after it happens, make sure the account's password does not expire. (See: https://dev.mysql.com/doc/refman/5.7/en/password-management.html )
MySQL/MariaDB can be installed on just about every major OS and NAS:
Important: Please use only supported versions of the MySQL or MariaDB server. As of January 2019, this is MySQL in at least version 5.7 or MariaDB in at least version 5.5, but version 10.3+ is recommended.
Next step: | Setting up Kodi |