Next Previous Contents

## 6. MySQL.

## 6.1 Distribution-specific information

### Mandriva

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.

NOTE: There have been reports that MySQL isn't starting at boot. If this is happening to you, try running the following commands.

> `

>     $ su
>     # chkconfig --level 35 mysql on
>     # /etc/rc.d/init.d/mysql start
>     # exit

> `

### Red Hat Linux and Fedora Core

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.

This can be done from the command line by typing:

> `

>     # /sbin/chkconfig mysqld on
>     # /sbin/service mysqld start

> `

### Gentoo

After installing MySQL you need to initialize the database by running mysql_install_db as root.

## 6.2 Setting up the initial database

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 `database/mc.sql` file to it.

To setup the initial MySQL databases:

> `

>     $ cd database

> `

### Mandriva and Red Hat Linux/Fedora Core

> `

>     $ mysql -u root < mc.sql

> `

### Debian 3.0

> `

>     $ mysql < mc.sql

> `

### Gentoo

> `

>     $ su
>     # mysql < /usr/share/mythtv/database/mc.sql

> `

NOTE: It is good practice to set a root password for MySQL. Instructions for doing so can be found on MySQL's web site at http://www.mysql.com/doc/en/Security.html.

### Modifying access to the MySQL database for multiple systems

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 `mc.sql` script is only granting access to the local host.

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.

NOTE: The "no security" option is very dangerous unless you're in a controlled environment.
This example has no security at all, and allows access from any host.

> `

>     $ mysql -u root mythconverg
>     mysql> grant all on mythconverg.* to mythtv@"%" identified by "mythtv";
>     mysql> flush privileges;

> `

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:

> `

>     $ mysql -u root mythconverg
>     mysql> grant all on mythconverg.* to mythtv@"%.mydomain.com" identified by "mythtv";
>     mysql> flush privileges;

> `

Finally, if you just want to restrict by IP subnet (in this example, the 192.168.1. network):

> `

>     $ mysql -u root mythconverg
>     mysql> grant all on mythconverg.* to mythtv@"192.168.1.%" identified by "mythtv";
>     mysql> flush privileges;

> `

Next Previous Contents