summaryrefslogtreecommitdiffstats
path: root/abs/core/local-website/htdocs/mythtv-doc/mythtv-HOWTO-6.html
blob: 2f9af204661b8d792212344d7e9ca00ff833f71b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
 <META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.21">
 <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>When you install MySQL 5.x 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="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>