MySQL/Setting up MySQL: Difference between revisions
< MySQL
Jump to navigation
Jump to search
No edit summary |
Mildenhall (talk | contribs) |
||
(15 intermediate revisions by 10 users not shown) | |||
Line 3: | Line 3: | ||
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. | 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:'''| Don't create the MySQL databases on your server'''. Simply set up the MySQL server itself, as Kodi will create the specific databases by itself.}} | {{redv|'''Please Note:'''| Don't create the MySQL databases on your server'''. Simply set up the MySQL server itself, as Kodi will create the specific databases by itself.}} | ||
{{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-expiration-policy.html )}} | |||
MySQL can be installed on just about every major OS: | MySQL can be installed on just about every major OS: | ||
Line 11: | Line 12: | ||
=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/16.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/ | #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: | ||
##from: <code>bind-address = 127.0.0.1</code> | ##from: <code>bind-address = 127.0.0.1</code> | ||
##to: <code>bind-address = 192.168.0.5</code> | ##to: <code>bind-address = 192.168.0.5</code> | ||
#*Note: Replace 192.168.0.5 with the appropriate address. | #*Note: Replace 192.168.0.5 with the appropriate address. | ||
#*Note: To allow local and remote access | #*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. | ||
#Restart your MySQL server. <code> | #Restart your MySQL server. <code>sudo restart mysql</code> (Ubuntu 14.04) or <code>sudo service mysql restart</code> (Ubuntu 15.04 or later) | ||
#Get into the MySQL command line utility: <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 | ||
Line 51: | Line 52: | ||
#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 your MySQL root password as set above, or just press enter if you didn't set one to log in with a blank password | #*Enter your MySQL root password as set above, or just press enter if you didn't set one to log in with a blank password | ||
#Enter the following commands: | |||
##Type in: <code>CREATE USER 'kodi' IDENTIFIED BY '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 | |||
#Close out the command line tool with <code>\q</code> | |||
=RaspberryPi Raspbian= | |||
'''RaspberryPi Raspbian:''' | |||
#<code>$sudo apt-get update && sudo apt-get dist-upgrade</code> to ensure that you have the very latest iteration of Raspbian. ''(September 2017 as of writing this)'' | |||
#<code>$sudo apt-get install mysql-server</code> to install ''MYSQL Server''. | |||
#To configure MySQL to listen for connections from network hosts, <code>$sudo nano /etc/mysql/mariadb.conf.d/50-server.cnf</code> and change the bind-address directive to the server's IP address: | |||
##from: <code>bind-address = 127.0.0.1</code> | |||
##to: <code>bind-address = 192.168.0.5</code> | |||
#*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. | |||
#Restart your MySQL server: <code>sudo service mysql restart</code> | |||
#Get into the MySQL command line utility: <code>sudo mysql</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 | ||
Line 93: | Line 112: | ||
=== Windows 7/8/8.1 Built-in Firewall === | === Windows 7/8/8.1 Built-in Firewall === | ||
: Run the following command in powershell or execute all the steps below. | : Run the following command in powershell or execute all the steps below. | ||
:::<syntaxhighlight lang="text" enclose="div"> | |||
New-NetFirewallRule -DisplayName "Allow inbound TCP Port 3306 for MySQL" -Direction inbound –LocalPort 3306 -Protocol TCP -Action Allow | |||
</syntaxhighlight> | |||
:#Go to control panel and open Windows Firewall | :#Go to control panel and open Windows Firewall | ||
:#Click on Advanced Settings | :#Click on Advanced Settings | ||
Line 102: | Line 123: | ||
:#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 | ||
=== Windows XP Built-in Firewall === | === Windows XP Built-in Firewall === | ||
:#Open Control Panel and Set to 'Classic View' | :#Open Control Panel and Set to 'Classic View' | ||
Line 117: | Line 139: | ||
##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 | ||
##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 | |||
#Close out the command line tool | #Close out the command line tool | ||
Line 126: | Line 149: | ||
*Devices running Arch Linux ARM (such as the PogoPlug, Dockstar, etc) can use the [[HOW-TO:Share libraries using MySQL/Setting up MySQL/ALARM|Arch Linux instructions]] on this page. | *Devices running Arch Linux ARM (such as the PogoPlug, Dockstar, etc) can use the [[HOW-TO:Share libraries using MySQL/Setting up MySQL/ALARM|Arch Linux instructions]] on this page. | ||
*[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 | ||
*http://forum.kodi.tv/showthread.php?tid=172548 - unRAID | *http://forum.kodi.tv/showthread.php?tid=172548 - unRAID | ||
After setting up a database server on you NAS, you should create a Kodi user with full administrative privileges. The user should be able to log in from your Kodi devices, so make sure you give the user login access from external machines. | |||
You do not need to create a database as Kodi will create the required databases itself. | |||
{{redv|'''Warning:'''| As you are giving the Kodi user full administrative privileges and external machine access it is recommended that you review your database security. It is highly recommenced that you block internet access to your database using an appropriate firewall. }} | |||
=FreeNAS and freeBSD= | =FreeNAS and freeBSD= | ||
Line 211: | Line 239: | ||
#<code>GRANT ALL ON `MyVideos%`.* TO 'kodi'@'%' IDENTIFIED BY 'kodi';</code> | #<code>GRANT ALL ON `MyVideos%`.* TO 'kodi'@'%' IDENTIFIED BY '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 /> | ||
The limited grants on this page don't give the kodi user permissions to create required TRIGGERs during install or upgrade. | Use the broader grant *.* statement that is explained on the previous tabs while creating or upgrading the tables. Only restrict rights afterwards, if you need to. <br> | ||
'''Kodi requires these TRIGGERs to function properly.''' | |||
Use the broader grant *.* statement that is explained on the previous tabs while creating or upgrading the tables. Only restrict rights afterwards, if you need to. | |||
Alternatively, figure out how to specifically give the account the right to create the require TRIGGERS - this varies between MySQL versions. }} | Alternatively, figure out how to specifically give the account the right to create the require TRIGGERS - this varies between MySQL versions. }} | ||
<headertabs /> | <headertabs /> |
Revision as of 23:05, 27 November 2017
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: Don't create the MySQL databases on your server. Simply set up the MySQL server itself, as Kodi will create the specific databases by itself.
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-expiration-policy.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-expiration-policy.html )
MySQL can be installed on just about every major OS:
Next step: | Setting up Kodi |