https://kodi.wiki/api.php?action=feedcontributions&user=Sytone&feedformat=atomOfficial Kodi Wiki - User contributions [en]2024-03-28T20:02:07ZUser contributionsMediaWiki 1.39.6https://kodi.wiki/index.php?title=HOW-TO:Python_Development_in_Visual_Studio&diff=95577HOW-TO:Python Development in Visual Studio2015-05-14T15:07:13Z<p>Sytone: </p>
<hr />
<div>== Getting Started ==<br />
This guide is based on Visual Studio 2013, this guidance may be relevant for other versions but mileage may vary!<br />
<br />
* Install Visual Studio 2013 and update it. <br />
* Download Python for Windows ( <= v2.7)<br />
** [https://www.python.org/downloads/ Link to downloads at python.org]<br />
* Install Python Tools for Visual Studio<br />
** [http://pytools.codeplex.com/ Python Tools for Visual Studio on codeplex]<br />
<br />
== Setting up your Project ==<br />
<br />
If you have existing code go to '''''File''''' -> '''''New''''' -> '''''Project''''' and select '''From Existing Python Code''', otherwise select '''Python Application'''. these project templates are under Templates / Python<br />
Update the name and the location relevant to your choice. <br />
<br />
=== From Existing Python Code ===<br />
For the existing code option ensure all the files are added, if you miss some you can add them to the project later. <br />
On the next page select the Python version you are running against. <br />
On the final page ensure you are happy with your project file name and location and click on Finish. <br />
<br />
=== Python Application ===<br />
TODO<br />
<br />
== Project Setup ==<br />
<br />
These are optional but make the experience better.<br />
<br />
To enable better intellisense for kodi components use XBMCstubs. This can be downloaded @ https://github.com/romanvm/xbmcstubs and all you need to do is add the location you downloaded the files from to the Search Paths. <br />
Add the kodi addons directory to the search paths for the addons you are referencing. An example would be <KODI Root>\portable_data\addons\script.common.plugin.cache\lib to allow intellisense to work for StorageServer<br />
<br />
Note: Intellisense will not be fully active until the DB is created, Press <Ctrl+K, `> to see its progress.<br />
== Running your project ==<br />
<br />
Once you have a project up and running you have the magic of Visual Studio and the python tools at your disposal, along with any other adding to visual studio you like. <br />
<br />
Right click on you python file that is the starting point for the plugin and ensure it is set as the startup file. If it is already bolded you do not have to worry about this.<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
== Debugging your project ==<br />
Work in Progress: Currently the attach process does not seem to be picking correctly for the breakpoints. <br />
<br />
To debug your project you need to add a reference to ptvsd to your script and the project to enable intellisense. <br />
<br />
* Install ptvsd via pip<br />
pip install ptvsd <br />
* Add the following lines to the top of your script. Remember to comment out or remove once completed. <br />
import ptvsd<br />
ptvsd.enable_attach(secret = 'mysecret')<br />
ptvsd.wait_for_attach<br />
* Set the breakpoint in your script that you want to check. <br />
* Start KODI<br />
* Start your plugin. <br />
* In Visual Studio use '''''Debug''''' -> '''''Attach to Process''''' menu command, which opens the '''Attach to Process''' dialog. The first thing to do in it is to open the '''Transport''' combo box, and change selection to '''Python remote debugging'''<br />
* For the qualifier add tcp://mysecret@localhost/</div>Sytonehttps://kodi.wiki/index.php?title=HOW-TO:Python_Development_in_Visual_Studio&diff=95511HOW-TO:Python Development in Visual Studio2015-05-13T02:34:24Z<p>Sytone: Created page with "== Getting Started == This guide is based on Visual Studio 2013, this guidance may be relevant for other versions but mileage may vary! * Install Visual Studio 2013 and updat..."</p>
<hr />
<div>== Getting Started ==<br />
This guide is based on Visual Studio 2013, this guidance may be relevant for other versions but mileage may vary!<br />
<br />
* Install Visual Studio 2013 and update it. <br />
* Download Python for Windows ( <= v2.7)<br />
** [https://www.python.org/downloads/ Link to downloads at python.org]<br />
* Install Python Tools for Visual Studio<br />
** [http://pytools.codeplex.com/ Python Tools for Visual Studio on codeplex]<br />
<br />
== Setting up your Project ==<br />
<br />
If you have existing code go to '''''File''''' -> '''''New''''' -> '''''Project''''' and select '''From Existing Python Code''', otherwise select '''Python Application'''. these project templates are under Templates / Python<br />
Update the name and the location relevant to your choice. <br />
<br />
=== From Existing Python Code ===<br />
For the existing code option ensure all the files are added, if you miss some you can add them to the project later. <br />
On the next page select the Python version you are running against. <br />
On the final page ensure you are happy with your project file name and location and click on Finish. <br />
<br />
=== Python Application ===<br />
TODO<br />
<br />
== Running your project ==<br />
<br />
Once you have a project up and running you have the magic of Visual Studio and the python tools at your disposal, along with any other adding to visual studio you like. <br />
<br />
Right click on you python file that is the starting point for the plugin and ensure it is set as the startup file. If it is already bolded you do not have to worry about this.</div>Sytonehttps://kodi.wiki/index.php?title=Add-on:Common_plugin_cache&diff=89018Add-on:Common plugin cache2015-04-15T01:07:25Z<p>Sytone: /* Setup */</p>
<hr />
<div>{{Addon <br />
|Name=Common plugin cache<br />
|provider-name=TheCollective<br />
|ID=script.common.plugin.cache<br />
|latest-version=2.5.5<br />
|extension point=xbmc.service<br />
|provides=<br />
|Summary=Common caching api for xbmc plugins.<br />
|Description=<br />
|Platform=all<br />
|Language=<br />
|License=<br />
|Forum=<br />
|Website=<br />
|Source=<br />
|Email=<br />
|broken=<br />
|icon url=http://mirrors.kodi.tv/addons/gotham/script.common.plugin.cache/icon.png}}<br />
= Testing/Status =<br />
Integration and unittests are run continously by Jenkins<br />
<br />
http://tc.tobiasussing.dk/jenkins/view/Cache%20Service/<br />
<br />
= Developers =<br />
This service works as an independant storage server to XBMC's implementation.<br />
<br />
It provides proper thread safe locking and get set functions to store data.<br />
<br />
Do note that important data should NOT be stored using this service as the sqlite database will be deleted on any corruption.<br />
<br />
Development and support thread: http://forum.xbmc.org/showthread.php?t=116496<br />
<br />
== Setup ==<br />
To use the cacheing service edit your addon.xml file like this.<br />
<br />
<requires><br />
<import addon="xbmc.python" version="2.1.0"/><br />
<import addon="script.common.plugin.cache" version="2.5.5"/> # Add this<br />
</requires><br />
<br />
And add the following to your py file.<br />
<br />
try:<br />
import StorageServer<br />
except:<br />
import storageserverdummy as StorageServer<br />
cache = StorageServer.StorageServer("tablename", 24) # (Your plugin name, Cache time in hours)<br />
<br />
You can now access the caching service through the "cache" variable.<br />
<br />
Remember to include a fallback storageserverdummy.py file(Copy it from the script.common.plugin.cache/lib/ directory)<br />
<br />
== Debugging ==<br />
To enable debugging set the following values in default.py<br />
<br />
dbg = True<br />
<br />
Or you can change it after import with.<br />
<br />
common.dbg = True<br />
<br />
Note: Only the client communication will be debugged when setting this flag.<br />
<br />
== cacheFunction(self, funct = False, *args) ==<br />
Caching function results for one day.<br />
<br />
The function being cached must return a list or a dictionary.<br />
<br />
A cache is only stored if the result returned is longer than 0 in length.<br />
<br />
Returns what the provided function returns.<br />
<br />
def pi_count(self):<br />
def arccot(x, unity):<br />
sum = xpower = unity // x<br />
n = 3<br />
sign = -1<br />
while 1:<br />
xpower = xpower // (x*x)<br />
term = xpower // n<br />
if not term:<br />
break<br />
sum += sign * term<br />
sign = -sign<br />
n += 2<br />
return sum<br />
<br />
digits = 40<br />
unity = 10**(digits + 10)<br />
pi = 4 * (4*arccot(5, unity) - arccot(239, unity))<br />
return pi // 10**10<br />
<br />
result = cache.cacheFunction(pi_count) # This will call the pi_count function, save the result in the cache, and return the result.<br />
time.sleep(300)<br />
result = cache.cacheFunction(pi_count) # This will return the cached result<br />
time.sleep(3600)<br />
result = cache.cacheFunction(pi_count) # This will again call pi_count since the result is now considered stale.<br />
<br />
To pass arguments to the function, you just add them as additional arguments to cacheFunction.<br />
<br />
result = cache.cacheFunction(calc_add, 4, 4)<br />
second_result = cache.cacheFunction(another_function, 5, ret = "True", { "complicated": "true" } )<br />
<br />
If you need to pass on another function as an argument, this must be done in in a dictionary like this: { "new_results_function": pi_count }.<br />
<br />
Because functions are instances they have specific identifiers that will change on every run. When cacheFunction generates the hash for a call and its result it will not take into account params["new_results_function"]. This means:<br />
* One should NOT use params["new_results_function"] for anything OTHER than a function, since cacheFunction will then return false matches.<br />
* One should NOT pass on a function in any way other than params["new_results_function"], as cacheFunction will never find a match.<br />
<br />
def some_function(first, second, params = {} ):<br />
if params.has_key("new_results_function"):<br />
return params["new_results_function"](first, second)<br />
else:<br />
return 0<br />
<br />
result = cache.cacheFunction(some_function, 1, 3, params = { "new_results_function": calc_add } )<br />
<br />
== lock(self, str) ==<br />
Try to aquire a lock<br />
<br />
Returns bool <br />
<br />
cache.table_name = "PluginName"<br />
locked = cache.lock("lock_me") # Returns True<br />
if locked:<br />
print "Got lock"<br />
<br />
new_lock = cache.lock("lock_me") # Returns False<br />
if not new_lock:<br />
print "Couldn't aquire second lock.<br />
<br />
== unlock(self, str) ==<br />
Try to unlock<br />
<br />
Returns bool<br />
<br />
cache.table_name = "PluginName"<br />
lock = cache.lock("lock_me") # Returns True<br />
<br />
unlocked = cache.unlock("lock_me") # Returns True<br />
if unlocked:<br />
print "Discarded lock"<br />
<br />
new_unlocked = cache.unlock("lock_me") # Returns False<br />
if not new_unlocked:<br />
print "Couldn't discard lock."<br />
<br />
== delete(self, str) ==<br />
Delete entities matching the str.<br />
<br />
This functions accepts [http://www.w3schools.com/SQL/sql_wildcards.asp SQL wildcards].<br />
<br />
Returns nothing<br />
<br />
cache.table_name = "PluginName"<br />
cache.set("mystring", "string")<br />
cache.set("myint", 1234)<br />
cache.set("mydict", repr({ "our": { "dictionary": [] } }) )<br />
cache.delete("my%")<br />
<br />
some_int = cache.get("myint")<br />
print some_int # prints ""<br />
<br />
some_string = cache.get("mystring")<br />
print some_string # prints ""<br />
<br />
some_dict = cache.get("mydict")<br />
print some_dict # prints ""<br />
<br />
== set(self, str, object ) ==<br />
Store a value<br />
<br />
Returns nothing<br />
<br />
cache.table_name = "PluginName"<br />
cache.set("some_string", "string")<br />
cache.set("some_int", 1234)<br />
cache.set("some_dict", repr({ "our": { "dictionary": [] } }) )<br />
<br />
== setMulti(self, str, dict) ==<br />
Store multiple values<br />
<br />
Returns nothing<br />
<br />
cache.table_name = "PluginName"<br />
<br />
save_data = { "some_string": "string", "some_int": 1234, "some_dict": repr({ "our": { "dictionary": [] } }) }<br />
cache.setMulti("pre-", save_data)<br />
<br />
== get(self, str) ==<br />
Get a value<br />
<br />
Returns stored data.<br />
<br />
cache.table_name = "PluginName"<br />
cache.set("some_string", "string")<br />
cache.set("some_int", 1234)<br />
cache.set("some_dict", repr({ "our": { "dictionary": [] } }) )<br />
<br />
some_string = cache.get("some_string")<br />
print some_string # Prints "string"<br />
<br />
some_int = cache.get("some_int")<br />
print some_int # prints 1234<br />
<br />
some_dict = cache.get("some_dict")<br />
print eval(some_dict) # prints '{ "our": { "dictionary": [] } }'<br />
<br />
== getMulti(self, str, list) ==<br />
Get multiple values<br />
<br />
Retuns list of stored data elements.<br />
<br />
cache.table_name = "PluginName"<br />
<br />
save_data = { "some_string": "string", "some_int": 1234, "some_dict": repr({ "our": { "dictionary": [] } }) }<br />
cache.setMulti("pre-", save_data)<br />
<br />
get_list = [ "some_string", "some_int", "some_dict" ]<br />
result = cache.getMulti("pre-", get_list)<br />
print result[0] # Prints "string"<br />
print result[1] # Prints 1234<br />
print eval(result[2]) # Prints '{ "our": { "dictionary": [] } }'<br />
<br />
[[Category:Frodo add-on repository]]<br />
[[Category:Gotham add-on repository]]</div>Sytonehttps://kodi.wiki/index.php?title=Add-on:Common_plugin_cache&diff=89017Add-on:Common plugin cache2015-04-15T01:06:54Z<p>Sytone: fix version in example.</p>
<hr />
<div>{{Addon <br />
|Name=Common plugin cache<br />
|provider-name=TheCollective<br />
|ID=script.common.plugin.cache<br />
|latest-version=2.5.5<br />
|extension point=xbmc.service<br />
|provides=<br />
|Summary=Common caching api for xbmc plugins.<br />
|Description=<br />
|Platform=all<br />
|Language=<br />
|License=<br />
|Forum=<br />
|Website=<br />
|Source=<br />
|Email=<br />
|broken=<br />
|icon url=http://mirrors.kodi.tv/addons/gotham/script.common.plugin.cache/icon.png}}<br />
= Testing/Status =<br />
Integration and unittests are run continously by Jenkins<br />
<br />
http://tc.tobiasussing.dk/jenkins/view/Cache%20Service/<br />
<br />
= Developers =<br />
This service works as an independant storage server to XBMC's implementation.<br />
<br />
It provides proper thread safe locking and get set functions to store data.<br />
<br />
Do note that important data should NOT be stored using this service as the sqlite database will be deleted on any corruption.<br />
<br />
Development and support thread: http://forum.xbmc.org/showthread.php?t=116496<br />
<br />
== Setup ==<br />
To use the cacheing service edit your addon.xml file like this.<br />
<br />
<requires><br />
<import addon="xbmc.python" version="2.0"/><br />
<import addon="script.common.plugin.cache" version="2.5.5"/> # Add this<br />
</requires><br />
<br />
And add the following to your py file.<br />
<br />
try:<br />
import StorageServer<br />
except:<br />
import storageserverdummy as StorageServer<br />
cache = StorageServer.StorageServer("tablename", 24) # (Your plugin name, Cache time in hours)<br />
<br />
You can now access the caching service through the "cache" variable.<br />
<br />
Remember to include a fallback storageserverdummy.py file(Copy it from the script.common.plugin.cache/lib/ directory)<br />
<br />
== Debugging ==<br />
To enable debugging set the following values in default.py<br />
<br />
dbg = True<br />
<br />
Or you can change it after import with.<br />
<br />
common.dbg = True<br />
<br />
Note: Only the client communication will be debugged when setting this flag.<br />
<br />
== cacheFunction(self, funct = False, *args) ==<br />
Caching function results for one day.<br />
<br />
The function being cached must return a list or a dictionary.<br />
<br />
A cache is only stored if the result returned is longer than 0 in length.<br />
<br />
Returns what the provided function returns.<br />
<br />
def pi_count(self):<br />
def arccot(x, unity):<br />
sum = xpower = unity // x<br />
n = 3<br />
sign = -1<br />
while 1:<br />
xpower = xpower // (x*x)<br />
term = xpower // n<br />
if not term:<br />
break<br />
sum += sign * term<br />
sign = -sign<br />
n += 2<br />
return sum<br />
<br />
digits = 40<br />
unity = 10**(digits + 10)<br />
pi = 4 * (4*arccot(5, unity) - arccot(239, unity))<br />
return pi // 10**10<br />
<br />
result = cache.cacheFunction(pi_count) # This will call the pi_count function, save the result in the cache, and return the result.<br />
time.sleep(300)<br />
result = cache.cacheFunction(pi_count) # This will return the cached result<br />
time.sleep(3600)<br />
result = cache.cacheFunction(pi_count) # This will again call pi_count since the result is now considered stale.<br />
<br />
To pass arguments to the function, you just add them as additional arguments to cacheFunction.<br />
<br />
result = cache.cacheFunction(calc_add, 4, 4)<br />
second_result = cache.cacheFunction(another_function, 5, ret = "True", { "complicated": "true" } )<br />
<br />
If you need to pass on another function as an argument, this must be done in in a dictionary like this: { "new_results_function": pi_count }.<br />
<br />
Because functions are instances they have specific identifiers that will change on every run. When cacheFunction generates the hash for a call and its result it will not take into account params["new_results_function"]. This means:<br />
* One should NOT use params["new_results_function"] for anything OTHER than a function, since cacheFunction will then return false matches.<br />
* One should NOT pass on a function in any way other than params["new_results_function"], as cacheFunction will never find a match.<br />
<br />
def some_function(first, second, params = {} ):<br />
if params.has_key("new_results_function"):<br />
return params["new_results_function"](first, second)<br />
else:<br />
return 0<br />
<br />
result = cache.cacheFunction(some_function, 1, 3, params = { "new_results_function": calc_add } )<br />
<br />
== lock(self, str) ==<br />
Try to aquire a lock<br />
<br />
Returns bool <br />
<br />
cache.table_name = "PluginName"<br />
locked = cache.lock("lock_me") # Returns True<br />
if locked:<br />
print "Got lock"<br />
<br />
new_lock = cache.lock("lock_me") # Returns False<br />
if not new_lock:<br />
print "Couldn't aquire second lock.<br />
<br />
== unlock(self, str) ==<br />
Try to unlock<br />
<br />
Returns bool<br />
<br />
cache.table_name = "PluginName"<br />
lock = cache.lock("lock_me") # Returns True<br />
<br />
unlocked = cache.unlock("lock_me") # Returns True<br />
if unlocked:<br />
print "Discarded lock"<br />
<br />
new_unlocked = cache.unlock("lock_me") # Returns False<br />
if not new_unlocked:<br />
print "Couldn't discard lock."<br />
<br />
== delete(self, str) ==<br />
Delete entities matching the str.<br />
<br />
This functions accepts [http://www.w3schools.com/SQL/sql_wildcards.asp SQL wildcards].<br />
<br />
Returns nothing<br />
<br />
cache.table_name = "PluginName"<br />
cache.set("mystring", "string")<br />
cache.set("myint", 1234)<br />
cache.set("mydict", repr({ "our": { "dictionary": [] } }) )<br />
cache.delete("my%")<br />
<br />
some_int = cache.get("myint")<br />
print some_int # prints ""<br />
<br />
some_string = cache.get("mystring")<br />
print some_string # prints ""<br />
<br />
some_dict = cache.get("mydict")<br />
print some_dict # prints ""<br />
<br />
== set(self, str, object ) ==<br />
Store a value<br />
<br />
Returns nothing<br />
<br />
cache.table_name = "PluginName"<br />
cache.set("some_string", "string")<br />
cache.set("some_int", 1234)<br />
cache.set("some_dict", repr({ "our": { "dictionary": [] } }) )<br />
<br />
== setMulti(self, str, dict) ==<br />
Store multiple values<br />
<br />
Returns nothing<br />
<br />
cache.table_name = "PluginName"<br />
<br />
save_data = { "some_string": "string", "some_int": 1234, "some_dict": repr({ "our": { "dictionary": [] } }) }<br />
cache.setMulti("pre-", save_data)<br />
<br />
== get(self, str) ==<br />
Get a value<br />
<br />
Returns stored data.<br />
<br />
cache.table_name = "PluginName"<br />
cache.set("some_string", "string")<br />
cache.set("some_int", 1234)<br />
cache.set("some_dict", repr({ "our": { "dictionary": [] } }) )<br />
<br />
some_string = cache.get("some_string")<br />
print some_string # Prints "string"<br />
<br />
some_int = cache.get("some_int")<br />
print some_int # prints 1234<br />
<br />
some_dict = cache.get("some_dict")<br />
print eval(some_dict) # prints '{ "our": { "dictionary": [] } }'<br />
<br />
== getMulti(self, str, list) ==<br />
Get multiple values<br />
<br />
Retuns list of stored data elements.<br />
<br />
cache.table_name = "PluginName"<br />
<br />
save_data = { "some_string": "string", "some_int": 1234, "some_dict": repr({ "our": { "dictionary": [] } }) }<br />
cache.setMulti("pre-", save_data)<br />
<br />
get_list = [ "some_string", "some_int", "some_dict" ]<br />
result = cache.getMulti("pre-", get_list)<br />
print result[0] # Prints "string"<br />
print result[1] # Prints 1234<br />
print eval(result[2]) # Prints '{ "our": { "dictionary": [] } }'<br />
<br />
[[Category:Frodo add-on repository]]<br />
[[Category:Gotham add-on repository]]</div>Sytonehttps://kodi.wiki/index.php?title=MySQL/Setting_up_MySQL&diff=81506MySQL/Setting up MySQL2014-11-18T05:04:19Z<p>Sytone: /* Windows */</p>
<hr />
<div>{{:MySQL/Contents}}<br />
{{mininav| [[MySQL]] }}<br />
You'll need to choose which of your computers, XBMC 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 XBMC device that is hosting most or all of your videos and music to also be the MySQL server, but this is not required.<br />
{{-}}<br />
<br />
{{note|XBMC v13 seems to have fixed the issue with MySQL 5.6, making it safe to use with XBMC.}}<br />
<br />
{{redv|'''Please Note:'''| Don't create the MySQL databases on your server'''. Simply set up the MySQL server itself, as XBMC will create the specific databases by itself.}}<br />
<br />
MySQL can be installed on just about every major OS:<br />
<br />
=Ubuntu Linux=<br />
'''Ubuntu Linux:'''<br />
#<code>$sudo apt-get install mysql-server</code> ''(see also: https://help.ubuntu.com/10.04/serverguide/C/mysql.html )''<br />
#Create a password when asked<br />
#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:<br />
##from: <code>bind-address = 127.0.0.1</code> <br />
##to: <code>bind-address = 192.168.0.5</code><br />
#*Note: Replace 192.168.0.5 with the appropriate address.<br />
#*Note: To allow local and remote access try comment out bind-address using a hash(#) or use <code>bind-address = 0.0.0.0</code><br />
#Restart your MySQL server. <code>$sudo restart mysql</code><br />
#Get into the MySQL command line utility: <code>$mysql -u root -p</code><br />
#Enter the following commands:<br />
##Type in: <code>CREATE USER 'xbmc' IDENTIFIED BY 'xbmc';</code> and press return<br />
##Type in: <code>GRANT ALL ON *.* TO 'xbmc';</code> and press return<br />
#Close out the command line tool with <code>\q</code><br />
<br />
=Arch Linux=<br />
'''Arch Linux:'''<br />
*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, XBMC will require no modifications to work with it.<br />
#Install MariaDB: <code>$ sudo pacman -S mariadb</code><br />
#Start the service: <code>$ sudo systemctl start mysqld</code><br />
#To have it automatically launch at startup: <code>$ sudo systemctl enable mysqld</code><br />
#Create a password: <code>$ /usr/bin/mysql_secure_installation</code> ''This will also clean up the demo database.''<br />
#Get into the MariaDB command line utility: <code>$ mysql -u root -p</code><br />
#Enter the following commands:<br />
##Type in: <code>CREATE USER 'xbmc' IDENTIFIED BY 'xbmc';</code> and press return<br />
##Type in: <code>GRANT ALL ON *.* TO 'xbmc';</code> and press return<br />
#Close out the command line tool with <code>\q</code><br />
<br />
=RedHat based Linux=<br />
'''RedHat based Linux (RHEL, CentOS, Fedora):'''<br />
#<code>$sudo yum install mysql-server</code><br />
#Create a password when asked<br />
#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:<br /><code>bind-address = 192.168.0.5</code><br />
#*Note: Replace 192.168.0.5 with the appropriate address.<br />
#*Note: Alternatively you can leave this file as is to allow local and remote access.<br />
#Restart your MySQL server. <code>$sudo /sbin/service mysqld restart</code><br />
#*Recommended - Set your MySQL root password with <code>/usr/bin/mysqladmin -u root password 'new-password'</code><br />
#Get into the MySQL command line utility: <code>$mysql -u root -p</code><br />
#*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<br />
#Enter the following commands:<br />
##Type in: <code>CREATE USER 'xbmc' IDENTIFIED BY 'xbmc';</code> and press return<br />
##Type in: <code>GRANT ALL ON *.* TO 'xbmc';</code> and press return<br />
#Close out the command line tool with <code>\q</code><br />
<br />
=Mac OS X=<br />
'''Mac OS X:'''<br />
#Download a copy of MySQL server from http://dev.mysql.com/downloads/mysql/<br />
#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.<br />
#Now to set up the "xbmc" user in MySQL and give it access. Launch Terminal.app on your Mac and issue the following commands, one line at a time:<br />
##<code>sudo /usr/local/mysql/bin/mysql</code><br />
##<code>CREATE USER 'xbmc' IDENTIFIED BY 'xbmc';</code><br />
##<code>GRANT ALL ON *.* TO 'xbmc';</code><br />
##<code>exit</code><br />
#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:<br />
##<code>cd /usr/local/mysql/support-files/</code><br />
##<code>sudo cp my-huge.cnf /etc/my.cnf</code><br />
##:''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.<br />
##<code>cd /etc</code><br />
##<code>sudo nano my.cnf</code><br />
##:''This opens a file in a command line text editor''<br />
##Scroll down to the [mysqld] section and add or edit the following line so that it appears as:<br />
##:<code>bind-address = ***.***.***.***</code><br />
##Save and exit from the command line text editor<br />
#Reboot the Mac, or restart the MySQL service from the System Preferences pane you installed earlier<br />
<br />
<br />
*Alternative guide for Mac OS X: http://forum.xbmc.org/showthread.php?tid=151631<br />
<br />
=Windows=<br />
== Installing MySQL on Windows ==<br />
If you have chocolatey installed run '''choco install mysql''' <br />
:'''or'''<br />
#Download a copy of MySQL server from http://dev.mysql.com/downloads/mysql/<br />
#Select ''Standard configuration''<br />
#Create a password when asked<br />
#Select that you want the database to have network access when prompted during installation.<br />
<br />
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 XBMC/Kodi on.<br />
=== Windows 7/8/8.1 Built-in Firewall ===<br />
: Run the following command in powershell or execute all the steps below.<br />
'''New-NetFirewallRule -DisplayName "Allow inbound TCP Port 3306 for MySQL" -Direction inbound –LocalPort 3306 -Protocol TCP -Action Allow'''<br />
:#Go to control panel and open Windows Firewall<br />
:#Click on Advanced Settings<br />
:#Click on Inbound Rules, then New Rule<br />
:#For the Rule Type, choose '''''Port''''' and hit Next<br />
:#For Protocol and Ports, select TCP protocol and type in '''''3306''''' for the '''''Specific local ports''''' and hit Next<br />
:#For Action, leave it at default which is '''''Allow the connection''''' and hit Next<br />
:#For Profile, you can leave it as default (everything checked by default) and hit Next<br />
:#For Name, set it to '''''MySQL''''' or any name that you will know what it is and click Finished<br />
=== Windows XP Built-in Firewall ===<br />
:#Open Control Panel and Set to 'Classic View'<br />
:#Double Click on Windows Firewall<br />
:#Click on tab that says Exceptions<br />
:#Click on Add Port<br />
:#Name it '''''MySQL''''' or any other name<br />
:#Set the port number to '''3306'''<br />
:#Choose '''''TCP''''' and click OK<br />
<br />
== Setup users in MySQL for XBMC/Kodi clients ==<br />
<br />
#Open the "MySQL Command Line Client" from the MySQL start menu<br />
#Enter the following commands:<br />
##Type in: <code>CREATE USER 'xbmc' IDENTIFIED BY 'xbmc';</code> and press return<br />
##Type in: <code>GRANT ALL ON *.* TO 'xbmc';</code> and press return<br />
#Close out the command line tool<br />
<br />
{{Note|If XBMC is unable to connect to the MySQL server, returning an error code [1130]:}}<br/><br />
If this occurs to you, try amending Step 2 above to read <code>GRANT ALL ON *.* TO 'xbmc'@'xxx.xxx.xxx.%';</code> 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.<br />
<br />
=Other NAS=<br />
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:<br />
<br />
*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.<br />
*[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<br />
*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<br />
*http://forum.xbmc.org/showthread.php?tid=172548 - unRAID<br />
<br />
=FreeNAS and freeBSD=<br />
<br />
== About FreeNAS ==<br />
<br />
http://www.freenas.org/<br />
<br />
<br />
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.<br />
<br />
<br />
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<br />
<br />
== How to ==<br />
<br />
=== Make a jail ===<br />
<br />
create a Jail via the FreeNAS webui - if unsure see here http://doc.freenas.org/index.php/Adding_Jails<br />
<br />
make a note of the jail IP address shown - you will need this to put in the advancedsettings.xml file on the XBMC machine later<br />
<br />
=== Prepare the jail ===<br />
<br />
<br />
*ssh into FreeNAS<br />
**If you have a windows PC use putty (http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html) <br />
**(easiest) click the "shell" button in the left of the FreeNAS webui<br />
<br />
<br />
type the following commands<br />
<br />
*<code>jls</code><br />
<br />
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<br />
<br />
*<code>jexec n csh</code><br />
<br />
=== Install mysql ===<br />
You are now inside your jail<br />
<br />
*<code>pkg install mysql55-server</code><br />
<br />
*<code>pkg install nano</code><br />
**(nano is a text editor you will need shortly)<br />
<br />
We now need to enable mysql in rc.conf<br />
<br />
*<code>nano /etc/rc.conf</code><br />
<br />
insert the line below into the rc.conf file<br />
<br />
*<code>mysql_enable="YES"</code><br />
<br />
save the file and exit (see bottom of nano edit page for keystrokes info)<br />
<br />
*<code>service mysql-server start</code><br />
<br />
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.<br />
<br />
*<code>mysql_secure_installation</code><br />
<br />
=== Configure mysql ready for xbmc to use ===<br />
<br />
type in<br />
<br />
*<code>mysql -u root -p</code><br />
<br />
<br />
You are now in mysql administration<br />
<br />
<br />
* <code>CREATE USER 'xbmc' IDENTIFIED BY 'xbmc';</code><br />
* <code>GRANT ALL ON *.* TO 'xbmc';</code><br />
* <code>quit;</code><br />
<br />
=Restricting MySQL access rights=<br />
'''Optional:''' '''If you only use the MySQL server for XBMC and that server has non-critical data on it, then this probably not necessary.'''<br />
For a more secure MySQL installation use these 2 commands to grant permission only to databases XBMC uses. This is useful if you plan on using your MySQL server for more than just XBMC, or if you're worried about your internal network being exposed and wanting to lock things down more, etc. <br />
#<code>GRANT ALL ON `MyMusic%`.* TO 'xbmc'@'%' IDENTIFIED BY 'xbmc';</code><br />
#<code>GRANT ALL ON `MyVideos%`.* TO 'xbmc'@'%' IDENTIFIED BY 'xbmc';</code><br />
<br />
{{Divbox|orange||<br />
The limited grants on this page don't give the xbmc user permissions to create required TRIGGERs during install or upgrade. <br />
'''XBMC requires these TRIGGERs to function properly.''' <br />
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 />
<br />
Alternatively, figure out how to specifically give the account the right to create the require TRIGGERS - this varies between MySQL versions. }}<br />
<headertabs /><br />
<br />
{{Next|[[MySQL/Setting up XBMC|Setting up XBMC]]}}<br />
<br />
{{Gotham updated}}</div>Sytonehttps://kodi.wiki/index.php?title=MySQL/Setting_up_MySQL&diff=81505MySQL/Setting up MySQL2014-11-18T04:56:20Z<p>Sytone: /* Windows */</p>
<hr />
<div>{{:MySQL/Contents}}<br />
{{mininav| [[MySQL]] }}<br />
You'll need to choose which of your computers, XBMC 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 XBMC device that is hosting most or all of your videos and music to also be the MySQL server, but this is not required.<br />
{{-}}<br />
<br />
{{note|XBMC v13 seems to have fixed the issue with MySQL 5.6, making it safe to use with XBMC.}}<br />
<br />
{{redv|'''Please Note:'''| Don't create the MySQL databases on your server'''. Simply set up the MySQL server itself, as XBMC will create the specific databases by itself.}}<br />
<br />
MySQL can be installed on just about every major OS:<br />
<br />
=Ubuntu Linux=<br />
'''Ubuntu Linux:'''<br />
#<code>$sudo apt-get install mysql-server</code> ''(see also: https://help.ubuntu.com/10.04/serverguide/C/mysql.html )''<br />
#Create a password when asked<br />
#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:<br />
##from: <code>bind-address = 127.0.0.1</code> <br />
##to: <code>bind-address = 192.168.0.5</code><br />
#*Note: Replace 192.168.0.5 with the appropriate address.<br />
#*Note: To allow local and remote access try comment out bind-address using a hash(#) or use <code>bind-address = 0.0.0.0</code><br />
#Restart your MySQL server. <code>$sudo restart mysql</code><br />
#Get into the MySQL command line utility: <code>$mysql -u root -p</code><br />
#Enter the following commands:<br />
##Type in: <code>CREATE USER 'xbmc' IDENTIFIED BY 'xbmc';</code> and press return<br />
##Type in: <code>GRANT ALL ON *.* TO 'xbmc';</code> and press return<br />
#Close out the command line tool with <code>\q</code><br />
<br />
=Arch Linux=<br />
'''Arch Linux:'''<br />
*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, XBMC will require no modifications to work with it.<br />
#Install MariaDB: <code>$ sudo pacman -S mariadb</code><br />
#Start the service: <code>$ sudo systemctl start mysqld</code><br />
#To have it automatically launch at startup: <code>$ sudo systemctl enable mysqld</code><br />
#Create a password: <code>$ /usr/bin/mysql_secure_installation</code> ''This will also clean up the demo database.''<br />
#Get into the MariaDB command line utility: <code>$ mysql -u root -p</code><br />
#Enter the following commands:<br />
##Type in: <code>CREATE USER 'xbmc' IDENTIFIED BY 'xbmc';</code> and press return<br />
##Type in: <code>GRANT ALL ON *.* TO 'xbmc';</code> and press return<br />
#Close out the command line tool with <code>\q</code><br />
<br />
=RedHat based Linux=<br />
'''RedHat based Linux (RHEL, CentOS, Fedora):'''<br />
#<code>$sudo yum install mysql-server</code><br />
#Create a password when asked<br />
#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:<br /><code>bind-address = 192.168.0.5</code><br />
#*Note: Replace 192.168.0.5 with the appropriate address.<br />
#*Note: Alternatively you can leave this file as is to allow local and remote access.<br />
#Restart your MySQL server. <code>$sudo /sbin/service mysqld restart</code><br />
#*Recommended - Set your MySQL root password with <code>/usr/bin/mysqladmin -u root password 'new-password'</code><br />
#Get into the MySQL command line utility: <code>$mysql -u root -p</code><br />
#*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<br />
#Enter the following commands:<br />
##Type in: <code>CREATE USER 'xbmc' IDENTIFIED BY 'xbmc';</code> and press return<br />
##Type in: <code>GRANT ALL ON *.* TO 'xbmc';</code> and press return<br />
#Close out the command line tool with <code>\q</code><br />
<br />
=Mac OS X=<br />
'''Mac OS X:'''<br />
#Download a copy of MySQL server from http://dev.mysql.com/downloads/mysql/<br />
#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.<br />
#Now to set up the "xbmc" user in MySQL and give it access. Launch Terminal.app on your Mac and issue the following commands, one line at a time:<br />
##<code>sudo /usr/local/mysql/bin/mysql</code><br />
##<code>CREATE USER 'xbmc' IDENTIFIED BY 'xbmc';</code><br />
##<code>GRANT ALL ON *.* TO 'xbmc';</code><br />
##<code>exit</code><br />
#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:<br />
##<code>cd /usr/local/mysql/support-files/</code><br />
##<code>sudo cp my-huge.cnf /etc/my.cnf</code><br />
##:''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.<br />
##<code>cd /etc</code><br />
##<code>sudo nano my.cnf</code><br />
##:''This opens a file in a command line text editor''<br />
##Scroll down to the [mysqld] section and add or edit the following line so that it appears as:<br />
##:<code>bind-address = ***.***.***.***</code><br />
##Save and exit from the command line text editor<br />
#Reboot the Mac, or restart the MySQL service from the System Preferences pane you installed earlier<br />
<br />
<br />
*Alternative guide for Mac OS X: http://forum.xbmc.org/showthread.php?tid=151631<br />
<br />
=Windows=<br />
'''Windows:'''<br />
#Download a copy of MySQL server from http://dev.mysql.com/downloads/mysql/ or if you have chocolatey installed run '''choco install mysql''' and go to step 5. <br />
#Select ''Standard configuration''<br />
#Create a password when asked<br />
#Select that you want the database to have network access when prompted during installation.<br />
#Open the "MySQL Command Line Client" from the MySQL start menu<br />
#Enter the following commands:<br />
##Type in: <code>CREATE USER 'xbmc' IDENTIFIED BY 'xbmc';</code> and press return<br />
##Type in: <code>GRANT ALL ON *.* TO 'xbmc';</code> and press return<br />
#Close out the command line tool<br />
#If you're using a firewall such as the one that's built into Windows, you will need to do this next step.<br />
:*'''Windows 7 Built-in Firewall''' <br />
: Run the following command in powershell or execute all the steps below.<br />
: PowerShell Command: '''New-NetFirewallRule -DisplayName "Allow inbound TCP Port 3306 for MySQL" –Direction inbound –LocalPort 3306 -Protocol TCP -Action Allow'''<br />
:#Go to control panel and open Windows Firewall<br />
:#Click on Advanced Settings<br />
:#Click on Inbound Rules, then New Rule<br />
:#For the Rule Type, choose '''''Port''''' and hit Next<br />
:#For Protocol and Ports, select TCP protocol and type in '''''3306''''' for the '''''Specific local ports''''' and hit Next<br />
:#For Action, leave it at default which is '''''Allow the connection''''' and hit Next<br />
:#For Profile, you can leave it as default (everything checked by default) and hit Next<br />
:#For Name, set it to '''''MySQL''''' or any name that you will know what it is and click Finished<br />
:*'''Windows XP Built-in Firewall'''<br />
:#Open Control Panel and Set to 'Classic View'<br />
:#Double Click on Windows Firewall<br />
:#Click on tab that says Exceptions<br />
:#Click on Add Port<br />
:#Name it '''''MySQL''''' or any other name<br />
:#Set the port number to '''3306'''<br />
:#Choose '''''TCP''''' and click OK<br />
<br />
{{Note|If XBMC is unable to connect to the MySQL server, returning an error code [1130]:}}<br/><br />
If this occurs to you, try amending Step 2 above to read <code>GRANT ALL ON *.* TO 'xbmc'@'xxx.xxx.xxx.%';</code> 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.<br />
<br />
=Other NAS=<br />
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:<br />
<br />
*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.<br />
*[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<br />
*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<br />
*http://forum.xbmc.org/showthread.php?tid=172548 - unRAID<br />
<br />
=FreeNAS and freeBSD=<br />
<br />
== About FreeNAS ==<br />
<br />
http://www.freenas.org/<br />
<br />
<br />
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.<br />
<br />
<br />
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<br />
<br />
== How to ==<br />
<br />
=== Make a jail ===<br />
<br />
create a Jail via the FreeNAS webui - if unsure see here http://doc.freenas.org/index.php/Adding_Jails<br />
<br />
make a note of the jail IP address shown - you will need this to put in the advancedsettings.xml file on the XBMC machine later<br />
<br />
=== Prepare the jail ===<br />
<br />
<br />
*ssh into FreeNAS<br />
**If you have a windows PC use putty (http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html) <br />
**(easiest) click the "shell" button in the left of the FreeNAS webui<br />
<br />
<br />
type the following commands<br />
<br />
*<code>jls</code><br />
<br />
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<br />
<br />
*<code>jexec n csh</code><br />
<br />
=== Install mysql ===<br />
You are now inside your jail<br />
<br />
*<code>pkg install mysql55-server</code><br />
<br />
*<code>pkg install nano</code><br />
**(nano is a text editor you will need shortly)<br />
<br />
We now need to enable mysql in rc.conf<br />
<br />
*<code>nano /etc/rc.conf</code><br />
<br />
insert the line below into the rc.conf file<br />
<br />
*<code>mysql_enable="YES"</code><br />
<br />
save the file and exit (see bottom of nano edit page for keystrokes info)<br />
<br />
*<code>service mysql-server start</code><br />
<br />
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.<br />
<br />
*<code>mysql_secure_installation</code><br />
<br />
=== Configure mysql ready for xbmc to use ===<br />
<br />
type in<br />
<br />
*<code>mysql -u root -p</code><br />
<br />
<br />
You are now in mysql administration<br />
<br />
<br />
* <code>CREATE USER 'xbmc' IDENTIFIED BY 'xbmc';</code><br />
* <code>GRANT ALL ON *.* TO 'xbmc';</code><br />
* <code>quit;</code><br />
<br />
=Restricting MySQL access rights=<br />
'''Optional:''' '''If you only use the MySQL server for XBMC and that server has non-critical data on it, then this probably not necessary.'''<br />
For a more secure MySQL installation use these 2 commands to grant permission only to databases XBMC uses. This is useful if you plan on using your MySQL server for more than just XBMC, or if you're worried about your internal network being exposed and wanting to lock things down more, etc. <br />
#<code>GRANT ALL ON `MyMusic%`.* TO 'xbmc'@'%' IDENTIFIED BY 'xbmc';</code><br />
#<code>GRANT ALL ON `MyVideos%`.* TO 'xbmc'@'%' IDENTIFIED BY 'xbmc';</code><br />
<br />
{{Divbox|orange||<br />
The limited grants on this page don't give the xbmc user permissions to create required TRIGGERs during install or upgrade. <br />
'''XBMC requires these TRIGGERs to function properly.''' <br />
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 />
<br />
Alternatively, figure out how to specifically give the account the right to create the require TRIGGERS - this varies between MySQL versions. }}<br />
<headertabs /><br />
<br />
{{Next|[[MySQL/Setting up XBMC|Setting up XBMC]]}}<br />
<br />
{{Gotham updated}}</div>Sytonehttps://kodi.wiki/index.php?title=MySQL/Setting_up_MySQL&diff=81504MySQL/Setting up MySQL2014-11-18T04:53:23Z<p>Sytone: /* Windows */</p>
<hr />
<div>{{:MySQL/Contents}}<br />
{{mininav| [[MySQL]] }}<br />
You'll need to choose which of your computers, XBMC 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 XBMC device that is hosting most or all of your videos and music to also be the MySQL server, but this is not required.<br />
{{-}}<br />
<br />
{{note|XBMC v13 seems to have fixed the issue with MySQL 5.6, making it safe to use with XBMC.}}<br />
<br />
{{redv|'''Please Note:'''| Don't create the MySQL databases on your server'''. Simply set up the MySQL server itself, as XBMC will create the specific databases by itself.}}<br />
<br />
MySQL can be installed on just about every major OS:<br />
<br />
=Ubuntu Linux=<br />
'''Ubuntu Linux:'''<br />
#<code>$sudo apt-get install mysql-server</code> ''(see also: https://help.ubuntu.com/10.04/serverguide/C/mysql.html )''<br />
#Create a password when asked<br />
#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:<br />
##from: <code>bind-address = 127.0.0.1</code> <br />
##to: <code>bind-address = 192.168.0.5</code><br />
#*Note: Replace 192.168.0.5 with the appropriate address.<br />
#*Note: To allow local and remote access try comment out bind-address using a hash(#) or use <code>bind-address = 0.0.0.0</code><br />
#Restart your MySQL server. <code>$sudo restart mysql</code><br />
#Get into the MySQL command line utility: <code>$mysql -u root -p</code><br />
#Enter the following commands:<br />
##Type in: <code>CREATE USER 'xbmc' IDENTIFIED BY 'xbmc';</code> and press return<br />
##Type in: <code>GRANT ALL ON *.* TO 'xbmc';</code> and press return<br />
#Close out the command line tool with <code>\q</code><br />
<br />
=Arch Linux=<br />
'''Arch Linux:'''<br />
*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, XBMC will require no modifications to work with it.<br />
#Install MariaDB: <code>$ sudo pacman -S mariadb</code><br />
#Start the service: <code>$ sudo systemctl start mysqld</code><br />
#To have it automatically launch at startup: <code>$ sudo systemctl enable mysqld</code><br />
#Create a password: <code>$ /usr/bin/mysql_secure_installation</code> ''This will also clean up the demo database.''<br />
#Get into the MariaDB command line utility: <code>$ mysql -u root -p</code><br />
#Enter the following commands:<br />
##Type in: <code>CREATE USER 'xbmc' IDENTIFIED BY 'xbmc';</code> and press return<br />
##Type in: <code>GRANT ALL ON *.* TO 'xbmc';</code> and press return<br />
#Close out the command line tool with <code>\q</code><br />
<br />
=RedHat based Linux=<br />
'''RedHat based Linux (RHEL, CentOS, Fedora):'''<br />
#<code>$sudo yum install mysql-server</code><br />
#Create a password when asked<br />
#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:<br /><code>bind-address = 192.168.0.5</code><br />
#*Note: Replace 192.168.0.5 with the appropriate address.<br />
#*Note: Alternatively you can leave this file as is to allow local and remote access.<br />
#Restart your MySQL server. <code>$sudo /sbin/service mysqld restart</code><br />
#*Recommended - Set your MySQL root password with <code>/usr/bin/mysqladmin -u root password 'new-password'</code><br />
#Get into the MySQL command line utility: <code>$mysql -u root -p</code><br />
#*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<br />
#Enter the following commands:<br />
##Type in: <code>CREATE USER 'xbmc' IDENTIFIED BY 'xbmc';</code> and press return<br />
##Type in: <code>GRANT ALL ON *.* TO 'xbmc';</code> and press return<br />
#Close out the command line tool with <code>\q</code><br />
<br />
=Mac OS X=<br />
'''Mac OS X:'''<br />
#Download a copy of MySQL server from http://dev.mysql.com/downloads/mysql/<br />
#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.<br />
#Now to set up the "xbmc" user in MySQL and give it access. Launch Terminal.app on your Mac and issue the following commands, one line at a time:<br />
##<code>sudo /usr/local/mysql/bin/mysql</code><br />
##<code>CREATE USER 'xbmc' IDENTIFIED BY 'xbmc';</code><br />
##<code>GRANT ALL ON *.* TO 'xbmc';</code><br />
##<code>exit</code><br />
#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:<br />
##<code>cd /usr/local/mysql/support-files/</code><br />
##<code>sudo cp my-huge.cnf /etc/my.cnf</code><br />
##:''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.<br />
##<code>cd /etc</code><br />
##<code>sudo nano my.cnf</code><br />
##:''This opens a file in a command line text editor''<br />
##Scroll down to the [mysqld] section and add or edit the following line so that it appears as:<br />
##:<code>bind-address = ***.***.***.***</code><br />
##Save and exit from the command line text editor<br />
#Reboot the Mac, or restart the MySQL service from the System Preferences pane you installed earlier<br />
<br />
<br />
*Alternative guide for Mac OS X: http://forum.xbmc.org/showthread.php?tid=151631<br />
<br />
=Windows=<br />
'''Windows:'''<br />
#Download a copy of MySQL server from http://dev.mysql.com/downloads/mysql/ or if you have chocolatey installed run '''choco install mysql''' and go to step 5. <br />
#Select ''Standard configuration''<br />
#Create a password when asked<br />
#Select that you want the database to have network access when prompted during installation.<br />
#Open the "MySQL Command Line Client" from the MySQL start menu<br />
#Enter the following commands:<br />
##Type in: <code>CREATE USER 'xbmc' IDENTIFIED BY 'xbmc';</code> and press return<br />
##Type in: <code>GRANT ALL ON *.* TO 'xbmc';</code> and press return<br />
#Close out the command line tool<br />
#If you're using a firewall such as the one that's built into Windows, you will need to do this next step.<br />
:*'''Windows 7 Built-in Firewall''' <br />
:#Go to control panel and open Windows Firewall<br />
:#Click on Advanced Settings<br />
:#Click on Inbound Rules, then New Rule<br />
:#For the Rule Type, choose '''''Port''''' and hit Next<br />
:#For Protocol and Ports, select TCP protocol and type in '''''3306''''' for the '''''Specific local ports''''' and hit Next<br />
:#For Action, leave it at default which is '''''Allow the connection''''' and hit Next<br />
:#For Profile, you can leave it as default (everything checked by default) and hit Next<br />
:#For Name, set it to '''''MySQL''''' or any name that you will know what it is and click Finished<br />
:*'''Windows XP Built-in Firewall'''<br />
:#Open Control Panel and Set to 'Classic View'<br />
:#Double Click on Windows Firewall<br />
:#Click on tab that says Exceptions<br />
:#Click on Add Port<br />
:#Name it '''''MySQL''''' or any other name<br />
:#Set the port number to '''3306'''<br />
:#Choose '''''TCP''''' and click OK<br />
<br />
{{Note|If XBMC is unable to connect to the MySQL server, returning an error code [1130]:}}<br/><br />
If this occurs to you, try amending Step 2 above to read <code>GRANT ALL ON *.* TO 'xbmc'@'xxx.xxx.xxx.%';</code> 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.<br />
<br />
=Other NAS=<br />
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:<br />
<br />
*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.<br />
*[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<br />
*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<br />
*http://forum.xbmc.org/showthread.php?tid=172548 - unRAID<br />
<br />
=FreeNAS and freeBSD=<br />
<br />
== About FreeNAS ==<br />
<br />
http://www.freenas.org/<br />
<br />
<br />
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.<br />
<br />
<br />
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<br />
<br />
== How to ==<br />
<br />
=== Make a jail ===<br />
<br />
create a Jail via the FreeNAS webui - if unsure see here http://doc.freenas.org/index.php/Adding_Jails<br />
<br />
make a note of the jail IP address shown - you will need this to put in the advancedsettings.xml file on the XBMC machine later<br />
<br />
=== Prepare the jail ===<br />
<br />
<br />
*ssh into FreeNAS<br />
**If you have a windows PC use putty (http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html) <br />
**(easiest) click the "shell" button in the left of the FreeNAS webui<br />
<br />
<br />
type the following commands<br />
<br />
*<code>jls</code><br />
<br />
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<br />
<br />
*<code>jexec n csh</code><br />
<br />
=== Install mysql ===<br />
You are now inside your jail<br />
<br />
*<code>pkg install mysql55-server</code><br />
<br />
*<code>pkg install nano</code><br />
**(nano is a text editor you will need shortly)<br />
<br />
We now need to enable mysql in rc.conf<br />
<br />
*<code>nano /etc/rc.conf</code><br />
<br />
insert the line below into the rc.conf file<br />
<br />
*<code>mysql_enable="YES"</code><br />
<br />
save the file and exit (see bottom of nano edit page for keystrokes info)<br />
<br />
*<code>service mysql-server start</code><br />
<br />
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.<br />
<br />
*<code>mysql_secure_installation</code><br />
<br />
=== Configure mysql ready for xbmc to use ===<br />
<br />
type in<br />
<br />
*<code>mysql -u root -p</code><br />
<br />
<br />
You are now in mysql administration<br />
<br />
<br />
* <code>CREATE USER 'xbmc' IDENTIFIED BY 'xbmc';</code><br />
* <code>GRANT ALL ON *.* TO 'xbmc';</code><br />
* <code>quit;</code><br />
<br />
=Restricting MySQL access rights=<br />
'''Optional:''' '''If you only use the MySQL server for XBMC and that server has non-critical data on it, then this probably not necessary.'''<br />
For a more secure MySQL installation use these 2 commands to grant permission only to databases XBMC uses. This is useful if you plan on using your MySQL server for more than just XBMC, or if you're worried about your internal network being exposed and wanting to lock things down more, etc. <br />
#<code>GRANT ALL ON `MyMusic%`.* TO 'xbmc'@'%' IDENTIFIED BY 'xbmc';</code><br />
#<code>GRANT ALL ON `MyVideos%`.* TO 'xbmc'@'%' IDENTIFIED BY 'xbmc';</code><br />
<br />
{{Divbox|orange||<br />
The limited grants on this page don't give the xbmc user permissions to create required TRIGGERs during install or upgrade. <br />
'''XBMC requires these TRIGGERs to function properly.''' <br />
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 />
<br />
Alternatively, figure out how to specifically give the account the right to create the require TRIGGERS - this varies between MySQL versions. }}<br />
<headertabs /><br />
<br />
{{Next|[[MySQL/Setting up XBMC|Setting up XBMC]]}}<br />
<br />
{{Gotham updated}}</div>Sytonehttps://kodi.wiki/index.php?title=HOW-TO:Install_Kodi_for_Windows&diff=81503HOW-TO:Install Kodi for Windows2014-11-18T04:09:11Z<p>Sytone: /* Installing of XBMC for Windows */</p>
<hr />
<div>{{mininav| [[Windows]] }}<br />
<br />
== Installing of XBMC for Windows ==<br />
<br />
The installation of XBMC for Windows is straightforward like most other Windows applications.<br />
<br />
Download the latest version from [http://xbmc.org/download/ http://xbmc.org/download/]. After download open the .exe file after which you will get the installation dialog. Simply follow the shown installation screen after which the installation will begin. For most users the offered default settings are sufficient, if not, change them accordingly if you are sure you have to.<br />
<br />
If you have [https://chocolatey.org/ Chocolatey] installed you can run '''choco install xbmc''' from a command line or powershell instance.<br />
<br />
After the installation you can immediately start using XBMC. To start XBMC, find it under the Windows '''Start''' button in a '''Program Group''' called '''XBMC'''. or simply use the desktop icon.<br />
<br />
You can use the keyboard, mouse or remote control to navigate through the program. Add one or more sources in Videos, Music and/or Photos, see [[Media Sources]] and you are ready to play your media. For more information you can visit the main [[Main Page|wiki page]].<br />
<br />
== Uninstalling of XBMC for Windows ==<br />
Go to "''Add or Remove Programs''" in the "''Control Panel''" under Windows then choose to remove "''XBMC''". You can also find it under the Windows '''Start''' button in a '''Program Group''' called '''XBMC'''.<br />
<br />
== Upgrading XBMC for Windows ==<br />
Unless your copy of XBMC is more than two years old, simply installing a newer version of XBMC over an older version should cause no problems. If you are upgrading your copy of XBMC, it is ALWAYS recommended that you backup your data: [[Backup]].<br />
<br />
{{gotham updated}}<br />
<br />
[[Category:Manual]]<br />
[[Category:Installation|Windows]]<br />
[[Category:Windows]]<br />
[[Category:How-to]]</div>Sytone