Sophie

Sophie

distrib > Mandriva > current > x86_64 > by-pkgid > 2d17ecc404292c0c782d719b211ea706 > files > 230

mythtv-doc-0.23-25073.1mdv2010.1.x86_64.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
 <META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.50">
 <TITLE>Installing and using MythTV: MySQL.</TITLE>
 <LINK HREF="mythtv-HOWTO-7.html" REL=next>
 <LINK HREF="mythtv-HOWTO-5.html" REL=previous>
 <LINK HREF="mythtv-HOWTO.html#toc6" REL=contents>
</HEAD>
<BODY>
<A HREF="mythtv-HOWTO-7.html">Next</A>
<A HREF="mythtv-HOWTO-5.html">Previous</A>
<A HREF="mythtv-HOWTO.html#toc6">Contents</A>
<HR>
<H2><A NAME="mysql"></A> <A NAME="s6">6.</A> <A HREF="mythtv-HOWTO.html#toc6">MySQL.</A></H2>

<P>You will also want to comment out "log-bin" in your <CODE>my.cnf</CODE>
configuration file.  This option will quickly fill your "/var" disk
partition with many gigabytes of data, unless you are doing database
replication and deleting these files regularly.</P>

<H2><A NAME="ss6.1">6.1</A> <A HREF="mythtv-HOWTO.html#toc6.1">Distribution-specific information</A>
</H2>

<H3>Mandriva</H3>

<P>If this is the system maintaining the database, make sure that MySQL is
running and started at boot.  Click on Mandriva Control
Center->System->Services, find MySQL and click the "On Boot" button and the
"Start" button if the MySQL status shows that it isn't running yet.</P>
<P>
<FIGURE>
<EPS FILE="warning.eps">
<IMG SRC="warning.png">
<CAPTION><B>NOTE</B>:  There have been reports that MySQL isn't starting at boot.
If this is happening to you, try running the following commands.</CAPTION>
</FIGURE>

<BLOCKQUOTE><CODE>
<PRE>
$ su
# chkconfig --level 35 mysql on
# /etc/rc.d/init.d/mysql start
# exit
</PRE>
</CODE></BLOCKQUOTE>
</P>

<H3>Red Hat Linux and Fedora Core</H3>

<P>If this is the system maintaining the database, make sure that MySQL is
running and started at boot. Click on Redhat menu>Server Settings>Services
and enter the root password when asked. Check "mysqld" and then click Start.
Click Save, then close the window.</P>
<P>This can be done from the command line by typing:
<BLOCKQUOTE><CODE>
<PRE>
# /sbin/chkconfig mysqld on
# /sbin/service mysqld start
</PRE>
</CODE></BLOCKQUOTE>
</P>

<H3>Gentoo</H3>

<P>After installing MySQL you need to initialize the database by running
<B>mysql_install_db</B> as root.</P>
<H2><A NAME="setupdb"></A> <A NAME="ss6.2">6.2</A> <A HREF="mythtv-HOWTO.html#toc6.2">Setting up the initial database </A>
</H2>

<P>This step is only required on the system maintaining the database, which
may or may not be one of your MythTV boxes.  If the database is on a
non-MythTV machine you'll need to copy the <CODE>database/mc.sql</CODE> file to it.</P>
<P>To setup the initial MySQL databases:
<BLOCKQUOTE><CODE>
<PRE>
$ cd database
</PRE>
</CODE></BLOCKQUOTE>
</P>
<H3>Mandriva and Red Hat Linux/Fedora Core</H3>

<P>
<BLOCKQUOTE><CODE>
<PRE>
$ mysql -u root &lt; mc.sql
</PRE>
</CODE></BLOCKQUOTE>
</P>
<H3>Debian 3.0</H3>

<P>
<BLOCKQUOTE><CODE>
<PRE>
$ mysql &lt; mc.sql
</PRE>
</CODE></BLOCKQUOTE>
</P>
<H3>Gentoo</H3>

<P>
<BLOCKQUOTE><CODE>
<PRE>
$ su
# mysql &lt; /usr/share/mythtv/database/mc.sql
</PRE>
</CODE></BLOCKQUOTE>

<FIGURE>
<EPS FILE="stop.eps">
<IMG SRC="stop.png">
<CAPTION><B>NOTE</B>: It is good practice to set a root password for MySQL.
Instructions for doing so can be found on MySQL's web site at 
<A HREF="http://www.mysql.com/doc/en/Security.html">http://www.mysql.com/doc/en/Security.html</A>.</CAPTION>
</FIGURE>
</P>
<H3><A NAME="modify_perm_mysql"></A> Modifying access to the MySQL database for multiple systems </H3>

<P>If you're going to have multiple systems accessing a master database,
you must grant access to the database from remote systems.  By default, the
<CODE>mc.sql</CODE> script is only granting access to the local host.</P>
<P>To allow other hosts access to your master database, you can either set it
up for no security at all, or with more granularity.  Note that the "%" is
the wildcard character in MySQL.</P>
<P>
<FIGURE>
<EPS FILE="stop.eps">
<IMG SRC="stop.png">
<CAPTION><B>NOTE</B>:  The "no security" option is <EM>very</EM> dangerous unless
you're in a controlled environment.</CAPTION>
</FIGURE>

This example has no security at all, and allows access from any host.
<BLOCKQUOTE><CODE>
<PRE>
$ mysql -u root mythconverg
mysql> grant all on mythconverg.* to mythtv@"%" identified by "mythtv";
mysql> flush privileges;
</PRE>
</CODE></BLOCKQUOTE>
</P>
<P>For a more secure setup, you can restrict which machines or subnets have
access. If you have a complete DNS system operational, you could do the
following:
<BLOCKQUOTE><CODE>
<PRE>
$ mysql -u root mythconverg
mysql> grant all on mythconverg.* to mythtv@"%.mydomain.com" identified by "mythtv";
mysql> flush privileges;
</PRE>
</CODE></BLOCKQUOTE>
</P>
<P>Finally, if you just want to restrict by IP subnet (in this example, the
192.168.1. network):
<BLOCKQUOTE><CODE>
<PRE>
$ mysql -u root mythconverg
mysql> grant all on mythconverg.* to mythtv@"192.168.1.%" identified by "mythtv";
mysql> flush privileges;
</PRE>
</CODE></BLOCKQUOTE>
</P>
<P>You'll also need to check that the "networking" feature of MySQL is turned
on. Check that <CODE>/etc/mysql/my.cnf</CODE> <EM>does not</EM> contain
<CODE>skip-networking</CODE>.  If it does, remove it.  Also verify that
<CODE>bind-address</CODE> is set to your IP address instead of
<CODE>127.0.0.1</CODE>.  If you change either of these items, restart
<B>MySQL</B>.</P>
<P><B>NOTE</B>:  Your distribution may have a customized MySQL configuration
file; in Mandriva, check <CODE>/etc/sysconfig/mysqld</CODE> for additional
configuration.</P>

<HR>
<A HREF="mythtv-HOWTO-7.html">Next</A>
<A HREF="mythtv-HOWTO-5.html">Previous</A>
<A HREF="mythtv-HOWTO.html#toc6">Contents</A>
</BODY>
</HTML>