Page 1 of 7 12345 ... LastLast
Results 1 to 10 of 63

Thread: On to next challenge : MySQL and XBMC! =)

  1. #1
    Senior Member
    Join Date
    Jun 2011
    Posts
    111

    On to next challenge : MySQL and XBMC! =)

    Not sure if this belongs in plugins, since it's not a plugin per se. (If not, mods, please feel free to move to appropriate section.) It's kind of a request that pertains to an add-on, I guess - and from the little I've read, it'll have to be dealt with through the jail construct and such.

    Thing is, if I got my FreeNAS box to also host my MySQL XBMC database, my setup would now be absolutely complete. =)

    First : There is a (Light, as I understand it) version of MySQL as part of FreeNAS as it is. Correct?

    Second : Is there any hope of a MySQL plugin being developed for us FreeBSD retards?

    Third : FYI, the MySQL setup part, for running an XBMC database, only includes these two lines in the MySQL command line :

    CREATE USER 'xbmc' IDENTIFIED BY 'xbmc'
    GRANT ALL ON *.* TO 'xbmc'

    After that, it's a question of pointing XBMC to the IP address of the computer hosting the MySQL database (via its advancedsettings.xml file), and creating necessary exceptions in the client computer's firewall, but all that's a cinch. So, my third question is : any way to enter these two lines of code into the MySQL database that I presume is already in my FreeNAS box?

    I'm assuming that once those two lines of code were put in, the rest would just flow very nicely - point XBMC to the ip address of my FreeNAS box (to be precise, the JAIL IP address, as I assume this MySQL would be run from within the jail) and off I go?

    Thanks a lot in advance! You guys rock!!!

  2. #2
    Senior Member
    Join Date
    Dec 2011
    Location
    San Luis Obispo, California, United States
    Posts
    715
    freenas doesn't use mysql. I'm pretty sure it used sqlite3, so adding the 'two lines of code' isn't an option. I also want to run mysql on freenas(in the jail) for xbmc.

    This is pretty much how you do it. (I'll test this Monday.. I may have the package/service names wrong below)
    *ssh into your freenas box
    ___
    jexec -u root 1 csh #enter your jail
    pkg_add -r mysql
    echo 'mysql_enable="YES"' >> /etc/rc.conf #add mysql to jail startup
    service mysql-server start
    ___
    At this point I'd secure mysql (there's a command for this) and add xbmc databases / users

    Once all the plugin stuff is pretty set I'll make a pbi for it.
    Last edited by Joshua Parker Ruehlig; 04-20-2012 at 10:41 AM.

  3. #3
    Senior Member
    Join Date
    Jun 2011
    Posts
    111
    Thanks Joshua,

    Quote Originally Posted by Joshua Parker Ruehlig View Post
    echo 'mysql_enable="YES"' >> /etc/rc.conf #add mysql to jail startup
    I don't understand this line. Do I paste just this (without the quotes) : "echo 'mysql_enable="YES"' >> /etc/rc.conf" ? The two >> arrows tell freeBSD to put "mysql_enable="YES"" in the /etc/rc.conf?

    Quote Originally Posted by Joshua Parker Ruehlig View Post
    At this point I'd secure mysql (there's a command for this) and add xbmc databases / users

    Once all the plugin stuff is pretty set I'll make a pbi for it.
    Cool! I'll have to research what securing MySQL means, but if you're up for developing a PBI, you'll have a legion of admirers. Well, starting with me, anyways. =)

    How would I secure, and then access the command line, for MySQL, within FreeNAS?

  4. #4
    Senior Member
    Join Date
    Dec 2011
    Location
    San Luis Obispo, California, United States
    Posts
    715
    Also yes, that command add's the line 'mysql_enable="YES"' to the jail's /etc/rc.conf file. This means it is enabled whenever the jail is rebooted / started up.

    The command I meant is 'mysql_secure_installation'
    I think it's built into freebsd's copy of mysql. It does a few things to close up security holes the default mysql install leaves, like an empty user and no password for the root mysql user.

  5. #5
    Senior Member
    Join Date
    Jun 2011
    Posts
    111
    Quote Originally Posted by Joshua Parker Ruehlig View Post
    Also yes, that command add's the line 'mysql_enable="YES"' to the jail's /etc/rc.conf file. This means it is enabled whenever the jail is rebooted / started up.

    The command I meant is 'mysql_secure_installation'
    I think it's built into freebsd's copy of mysql. It does a few things to close up security holes the default mysql install leaves, like an empty user and no password for the root mysql user.
    OK. So - how does one issue commands to the MySQL server from within the shell/jail? Like for adding users and such?

  6. #6
    Senior Member
    Join Date
    Jun 2011
    Posts
    111
    OK, so I got mysql installed. The actual command was 'pkg_add -r mysql51-server'. To login to mysql, first access the jail (jexec <jailID> csh) and then type 'mysql -u root'. (Remember - I'm typing this for the guys who are totally new at this, as I am.=)) I then input the two lines of code referred to above, and successfully created the user XBMC and granted all to it.

    I'm now in the process of trying it out with XBMC.
    Last edited by SilverJS; 04-21-2012 at 03:04 PM.

  7. #7
    Senior Member
    Join Date
    Jun 2011
    Posts
    111
    No go. XBMC just hangs at startup. Not sure why. This is probably way beyond me now. =)

  8. #8
    Senior Member
    Join Date
    Dec 2011
    Location
    San Luis Obispo, California, United States
    Posts
    715
    check the .xbmc/temp/xbmc.log, it'll log any database problems there. make sure the xbmc user you created can be accessed from your xbmc computer's ip. Not sure if those sql commands you put up there allow xbmc to connect from any ip or only local host.

    Also I had this successfully working before (though I was running mysql on freenas nativly, not a jail) so it definitely is possible.

  9. #9
    Senior Member
    Join Date
    Jun 2011
    Posts
    111
    OK, I'll have a look. As a question, why are we even running MySQL inside of the jail? Why not run it natively?

  10. #10
    Senior Member
    Join Date
    Dec 2011
    Location
    San Luis Obispo, California, United States
    Posts
    715
    cause freenas runs off a usb stick, it does alot of things to freebsd to make it more enbeded / stable / portable, so normal packages don't work as normal. most of the fielsystem is unwritable by default and is loaded into ram upon boot.

    In the end a jail is a much more elegant apporach to run something like mysql. I think theres no performance penalty for running mysql in a jail, so why not. I'm gonna play with this tonight and see where I get

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •