MySQL/Setting up MySQL: Difference between revisions
< MySQL
Jump to navigation
Jump to search
Mildenhall (talk | contribs) |
mNo edit summary |
||
(13 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
{{:MySQL/Contents}} | {{:MySQL/Contents}} | ||
{{mininav| [[MySQL]] }} | {{mininav| [[MySQL]] }} | ||
You'll need to choose which of your computers, Kodi devices, or | 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. | ||
{{-}} | {{-}} | ||
{{redv|'''Please Note:'''| | {{redv|'''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.}} | ||
{{redv|'''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.<br /> | {{redv|'''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.<br /> | ||
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- | 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 can be installed on just about every major OS: | MySQL/MariaDB can be installed on just about every major OS and NAS: | ||
{{redv|'''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.}} | |||
=Ubuntu Linux= | =Ubuntu Linux= | ||
'''Ubuntu Linux:''' | '''Ubuntu Linux:''' | ||
#<code>$sudo apt-get install mysql-server</code> ''(see also: https://help.ubuntu.com/ | #<code>$sudo apt-get install mysql-server</code> ''(see also: https://help.ubuntu.com/18.04/serverguide/mysql.html )'' | ||
#Create a password when asked | #Create a password when asked | ||
#To configure MySQL to listen for connections from network hosts, edit ''/etc/mysql/mysql.conf.d/mysqld.cnf'' and change the bind-address directive to the server's IP address: | #To configure MySQL to listen for connections from network hosts, edit ''/etc/mysql/mysql.conf.d/mysqld.cnf'' and change the bind-address directive to the server's IP address: | ||
Line 19: | Line 21: | ||
#*Note: Replace 192.168.0.5 with the appropriate address. | #*Note: Replace 192.168.0.5 with the appropriate address. | ||
#*Note: To allow both local and remote access (i.e. from both the MySQL host to itself and also from other clients), either comment out the bind-address using a hash (#) to disable it, or use <code>bind-address = 0.0.0.0</code> to open it completely. | #*Note: To allow both local and remote access (i.e. from both the MySQL host to itself and also from other clients), either comment out the bind-address using a hash (#) to disable it, or use <code>bind-address = 0.0.0.0</code> to open it completely. | ||
# | #When using MySQL8 or higher (Ubuntu 20.04 or later), add the following line at the end of ''/etc/mysql/mysql.conf.d/mysqld.cnf'': | ||
##<code>default_authentication_plugin=mysql_native_password</code> | |||
#Restart your MySQL server. <code>sudo service mysql restart</code> | |||
#Get into the MySQL command line utility: <code>mysql -u root -p</code> | #Get into the MySQL command line utility: <code>mysql -u root -p</code> | ||
#Enter the following commands: | #Enter the following commands: | ||
##Type in: <code>CREATE USER 'kodi' IDENTIFIED BY 'kodi';</code> and press return | ##Type in: <code>CREATE USER 'kodi' IDENTIFIED BY 'kodi';</code> and press return | ||
##*Note: When using MySQL8 or higher, there are additional password requirements and new authentication methods. Using the following command should avoid errors. Type in: <code>CREATE USER 'kodi' IDENTIFIED WITH mysql_native_password BY 'kodi123#';</code> and press return | |||
##Type in: <code>GRANT ALL ON *.* TO 'kodi';</code> and press return | ##Type in: <code>GRANT ALL ON *.* TO 'kodi';</code> and press return | ||
##Type in: <code>flush privileges;</code> and press return | ##Type in: <code>flush privileges;</code> and press return | ||
Line 104: | Line 109: | ||
If you have chocolatey installed run '''choco install mysql''' | If you have chocolatey installed run '''choco install mysql''' | ||
:'''or''' | :'''or''' | ||
#Download a copy of MySQL server from | #Download a copy of MySQL server from https://dev.mysql.com/downloads/windows/installer/8.0.html | ||
#Select '' | #Select ''Archives'' when you want the last stable main version 5.7.36 instead of version 8.0.x. | ||
#Create a password when asked | #Create a password when asked | ||
#Select that you want the database to have network access when prompted during installation. | #Select that you want the database to have network access when prompted during installation. | ||
Line 123: | Line 128: | ||
:#For Profile, you can leave it as default (everything checked by default) and hit Next | :#For Profile, you can leave it as default (everything checked by default) and hit Next | ||
:#For Name, set it to '''''MySQL''''' or any name that you will know what it is and click Finished | :#For Name, set it to '''''MySQL''''' or any name that you will know what it is and click Finished | ||
== Setup users in MySQL for Kodi clients == | == Setup users in MySQL for Kodi clients == | ||
Line 148: | Line 144: | ||
MySQL can also be installed on some [[w:network-attached storage|network-attached storage (NAS)]] device devices. Here are some guides for various NAS devices that can have a MySQL server installed: | MySQL can also be installed on some [[w:network-attached storage|network-attached storage (NAS)]] device devices. Here are some guides for various NAS devices that can have a MySQL server installed: | ||
*Devices running Arch Linux ARM (such as the PogoPlug, Dockstar, etc) can use the [[ | *Devices running Arch Linux ARM (such as the PogoPlug, Dockstar, etc) can use the [[Setting_up_MySQL|Arch Linux instructions]] on this page. | ||
*[https://web.archive.org/web/20160329053954/http://quixventure.com/2011/12/configure-a-synology-nas-as-mysql-server-for-xbmc/ Synology NAS as MySQL server for XBMC] and http://youtu.be/3PmmDtK65ks | *[https://web.archive.org/web/20160329053954/http://quixventure.com/2011/12/configure-a-synology-nas-as-mysql-server-for-xbmc/ Synology NAS as MySQL server for XBMC] and http://youtu.be/3PmmDtK65ks | ||
*http://www.robvanhamersveld.nl/2013/02/05/share-your-xbmc-12-0-library-on-a-synology-ds-or-other-nas/ Synology DS with MySQL guide based on Frodo | *http://www.robvanhamersveld.nl/2013/02/05/share-your-xbmc-12-0-library-on-a-synology-ds-or-other-nas/ Synology DS with MySQL guide based on Frodo | ||
Line 236: | Line 232: | ||
'''Optional:''' '''If you only use the MySQL server for Kodi and that server has non-critical data on it, then this probably not necessary.''' | '''Optional:''' '''If you only use the MySQL server for Kodi and that server has non-critical data on it, then this probably not necessary.''' | ||
For a more secure MySQL installation use these 2 commands to grant permission only to databases Kodi uses. This is useful if you plan on using your MySQL server for more than just Kodi, or if you're worried about your internal network being exposed and wanting to lock things down more, etc. | For a more secure MySQL installation use these 2 commands to grant permission only to databases Kodi uses. This is useful if you plan on using your MySQL server for more than just Kodi, or if you're worried about your internal network being exposed and wanting to lock things down more, etc. | ||
'''Upto MySQL Server 5.7 Server:''' | |||
#<code>GRANT ALL ON `MyVideos%`.* TO 'kodi'@'%' IDENTIFIED BY 'kodi';</code> | |||
#<code>GRANT ALL ON `MyMusic%`.* TO 'kodi'@'%' IDENTIFIED BY 'kodi';</code> | #<code>GRANT ALL ON `MyMusic%`.* TO 'kodi'@'%' IDENTIFIED BY 'kodi';</code> | ||
#<code>GRANT ALL ON `MyVideos%`.* TO | |||
'''As per MySQL 8.0 Server and upwards:''' | |||
#<code>GRANT ALL PRIVILEGES ON `MyVideos%.*` TO `kodi`@`%`;</code> | |||
#<code>GRANT ALL PRIVILEGES ON `MyMusic%.*` TO `kodi`@`%`;</code> | |||
{{redv|'''Careful'''|The limited grants on this page don't give the kodi user permissions to create required TRIGGERs during install or upgrade. '''Kodi requires these TRIGGERs to function properly.''' <br /> | {{redv|'''Careful'''|The limited grants on this page don't give the kodi user permissions to create required TRIGGERs during install or upgrade. '''Kodi requires these TRIGGERs to function properly.''' <br /> |
Revision as of 14:18, 24 January 2022
Share libraries w/MySQL, guide: |
MySQL | Setting up MySQL |
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 |