Difference between revisions of "MySQL"
(2 intermediate revisions by the same user not shown) | |||
Line 7: | Line 7: | ||
MrMC v3.x is compatible with Kodi 17.* databases. | MrMC v3.x is compatible with Kodi 17.* databases. | ||
+ | |||
+ | MrMC v3.9.3 is compatible with Kodi 18.* databases. | ||
+ | |||
+ | : {{color|red|With Kodi 18 database bump TV Show database listing seems to be a bit slow.}} (see here: https://forum.kodi.tv/showthread.php?tid=340340) | ||
+ | :: fix is mentioned here -> https://forum.libreelec.tv/thread/13990-mariadb-mysql-server-addon/?postID=108409#post108409 | ||
+ | :: <code># * Query Cache Configuration<br />query_cache_limit = 2M (was 1)<br />query_cache_size = 32M (was 16)</code> | ||
+ | |||
+ | |||
{{-}} | {{-}} | ||
Line 146: | Line 154: | ||
*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:// | + | *[http://youtu.be/3PmmDtK65ks Synology NAS as MySQL server for XBMC] |
*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.mrmc.tv/showthread.php?tid=172548 - unRAID | *http://forum.mrmc.tv/showthread.php?tid=172548 - unRAID | ||
Line 241: | Line 249: | ||
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. }} | ||
+ | |||
+ | == Connect MrMC using Settings/Services/MySql page as below == | ||
+ | <tabber> | ||
+ | Ariana Skin= | ||
+ | [[File:mysql ariana.png|600px|center]] | ||
+ | |||
+ | |-| | ||
+ | |||
+ | Opacity Skin= | ||
+ | [[File:mysql_opacity.png|600px|center]] | ||
+ | |||
+ | </tabber> |
Latest revision as of 03:54, 4 January 2020
Compatibility
MrMC v1.x is compatible with Kodi 15.* databases.
MrMC v2.x is compatible with Kodi 16.* databases.
MrMC v3.x is compatible with Kodi 17.* databases.
MrMC v3.9.3 is compatible with Kodi 18.* databases.
- With Kodi 18 database bump TV Show database listing seems to be a bit slow. (see here: https://forum.kodi.tv/showthread.php?tid=340340)
- fix is mentioned here -> https://forum.libreelec.tv/thread/13990-mariadb-mysql-server-addon/?postID=108409#post108409
# * Query Cache Configuration
query_cache_limit = 2M (was 1)
query_cache_size = 32M (was 16)
MySQL can be installed on just about every major OS:
Ubuntu Linux:
$sudo apt-get install mysql-server
(see also: https://help.ubuntu.com/10.04/serverguide/C/mysql.html )- Create a password when asked
- To configure MySQL to listen for connections from network hosts, edit /etc/mysql/my.cnf and change the bind-address directive to the server's IP address:
- from:
bind-address = 127.0.0.1
- to:
bind-address = 192.168.0.5
- 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
bind-address = 0.0.0.0
to open it completely.
- from:
- Restart your MySQL server.
$sudo restart mysql
- Get into the MySQL command line utility:
$mysql -u root -p
- Enter the following commands:
- Type in:
CREATE USER 'mrmc' IDENTIFIED BY 'mrmc';
and press return - Type in:
GRANT ALL ON *.* TO 'mrmc';
and press return - Type in:
flush privileges;
and press return
- Type in:
- Close out the command line tool with
\q
Arch Linux:
- Please note: Arch, along with many other distributions, has migrated to the faster and more open MariaDB. It is a drop in replacement to MySQL and, thus, mrmc will require no modifications to work with it.
- Install MariaDB:
$ sudo pacman -S mariadb
- Start the service:
$ sudo systemctl start mysqld
- To have it automatically launch at startup:
$ sudo systemctl enable mysqld
- Create a password:
$ /usr/bin/mysql_secure_installation
This will also clean up the demo database. - Get into the MariaDB command line utility:
$ mysql -u root -p
- Enter the following commands:
- Type in:
CREATE USER 'mrmc' IDENTIFIED BY 'mrmc';
and press return - Type in:
GRANT ALL ON *.* TO 'mrmc';
and press return - Type in:
flush privileges;
and press return
- Type in:
- Close out the command line tool with
\q
RedHat based Linux (RHEL, CentOS, Fedora):
$sudo yum install mysql-server
- Create a password when asked
- To configure MySQL to listen for connections only from network hosts, edit /etc/mysql/my.cnf and add the bind-address directive to the server's IP address:
bind-address = 192.168.0.5
- Note: Replace 192.168.0.5 with the appropriate address.
- Note: Alternatively you can leave this file as is to allow local and remote access.
- Restart your MySQL server.
$sudo /sbin/service mysqld restart
- Recommended - Set your MySQL root password with
/usr/bin/mysqladmin -u root password 'new-password'
- Recommended - Set your MySQL root password with
- Get into the MySQL command line utility:
$mysql -u root -p
- 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:
CREATE USER 'mrmc' IDENTIFIED BY 'mrmc';
and press return - Type in:
GRANT ALL ON *.* TO 'mrmc';
and press return - Type in:
flush privileges;
and press return
- Type in:
- Close out the command line tool with
\q
Mac OS X:
- Download a copy of MySQL server from http://dev.mysql.com/downloads/mysql/
- In Mac OS X, go to System Preferences -> MySQL, and click on “Start MySQL Server”. You’ll also want to tick to enable the “Automatically … on Startup” option.
- Now to set up the "mrmc" user in MySQL and give it access. Launch Terminal.app on your Mac and issue the following commands, one line at a time:
sudo /usr/local/mysql/bin/mysql
CREATE USER 'mrmc' IDENTIFIED BY 'mrmc';
GRANT ALL ON *.* TO 'mrmc';
exit
- Remain in Terminal.app. Now you'll be giving other computers on your network access to MySQL. Enter the next set of commands, one line at a time:
cd /usr/local/mysql/support-files/
sudo cp my-huge.cnf /etc/my.cnf
- The command line will ask for your Mac OS X user password. Enter it and press return. No text will show when you type your password in, this is normal.
cd /etc
sudo nano my.cnf
- This opens a file in a command line text editor
- Scroll down to the [mysqld] section and add or edit the following line so that it appears as:
bind-address = ***.***.***.***
- Save and exit from the command line text editor
- Reboot the Mac, or restart the MySQL service from the System Preferences pane you installed earlier
- Alternative guide for Mac OS X: http://forum.mrmc.tv/showthread.php?tid=151631
Installing MySQL on Windows
If you have chocolatey installed run choco install mysql
- or
- Download a copy of MySQL server from http://dev.mysql.com/downloads/mysql/ (Grab version 5.5.42, there are issues with newer versions)
- Select Server only
- Create a password when asked
- Select that you want the database to have network access when prompted during installation.
If you're using a firewall such as the one that's built into Windows, you will need to follow the steps below for the version of windows you installed mrmc on.
Windows 7/8/8.1 Built-in Firewall
- 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
- Click on Advanced Settings
- Click on Inbound Rules, then New Rule
- For the Rule Type, choose Port and hit Next
- For Protocol and Ports, select TCP protocol and type in 3306 for the Specific local ports and hit Next
- For Action, leave it at default which is Allow the connection 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
Windows XP Built-in Firewall
- Open Control Panel and Set to 'Classic View'
- Double Click on Windows Firewall
- Click on tab that says Exceptions
- Click on Add Port
- Name it MySQL or any other name
- Set the port number to 3306
- Choose TCP and click OK
Setup users in MySQL for mrmc clients
- Open the "MySQL Command Line Client" from the MySQL start menu
- Enter the following commands:
- Type in:
CREATE USER 'mrmc' IDENTIFIED BY 'mrmc';
and press return - Type in:
GRANT ALL ON *.* TO 'mrmc';
and press return
- Type in:
- Close out the command line tool
If this occurs to you, try amending Step 2 above to read
GRANT ALL ON *.* TO 'mrmc'@'xxx.xxx.xxx.%';
where xxx.xxx.xxx is the first three quadrants of your home network's IP address (192.168.1 for example) and % as the last quadrant to allow addresses on the same subnet to connect.
MySQL can also be installed on some 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 Arch Linux instructions on this page.
- Synology NAS as MySQL server for XBMC
- 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.mrmc.tv/showthread.php?tid=172548 - unRAID
About FreeNAS
FreeNAS is a FreeBSD based NAS system that can be run on almost any hardware - it uses ZFS for disk and file management. It is used at home and in enterprise businesses. 99% of tasks can be done via the web interface.
Example below is based on FreeNAS 9.1.1 on 12/12/13, and assumes you have already configured your nas with drives, datasets etc
How to
Make a jail
create a Jail via the FreeNAS webui - if unsure see here http://doc.freenas.org/index.php/Adding_Jails
make a note of the jail IP address shown - you will need this to put in the advancedsettings.xml file on the mrmc machine later
Prepare the jail
- ssh into FreeNAS
- If you have a windows PC use putty (http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html)
- (easiest) click the "shell" button in the left of the FreeNAS webui
type the following commands
jls
Take note of the JID of the jail you created, use it in the command below and replace n with the number of the jail you just created
jexec n csh
Install mysql
You are now inside your jail
pkg install mysql55-server
pkg install nano
- (nano is a text editor you will need shortly)
We now need to enable mysql in rc.conf
nano /etc/rc.conf
insert the line below into the rc.conf file
mysql_enable="YES"
save the file and exit (see bottom of nano edit page for keystrokes info)
service mysql-server start
Optional step below - this is an automated script that will secure you mysql instance - it will prompt you for answers to questions. Its up to you if you do this.
mysql_secure_installation
Configure mysql ready for mrmc to use
type in
mysql -u root -p
You are now in mysql administration
CREATE USER 'mrmc' IDENTIFIED BY 'mrmc';
GRANT ALL ON *.* TO 'mrmc';
flush privileges;
quit;
Restricting MySQL access rights
Optional: If you only use the MySQL server for mrmc 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 mrmc uses. This is useful if you plan on using your MySQL server for more than just mrmc, or if you're worried about your internal network being exposed and wanting to lock things down more, etc.
GRANT ALL ON `MyMusic%`.* TO 'mrmc'@'%' IDENTIFIED BY 'mrmc';
GRANT ALL ON `MyVideos%`.* TO 'mrmc'@'%' IDENTIFIED BY 'mrmc';