Next Previous Contents

## 6. MySQL.

You will also want to comment out "log-bin" in your `my.cnf` 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.

## 6.1 Distribution-specific information

### 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

> `

## 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

> `

>     $ 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 configure MySQL database access with no security or with additional granularity.

NOTE: The "no security" option is very dangerous unless you're in a controlled environment.

The "%" is the wildcard character in MySQL.

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;

> `

You'll also need to check that the "networking" feature of MySQL is turned on. Check that `/etc/mysql/my.cnf` does not contain `skip-networking`. If it does, either remove that line or comment it out. Also verify that `bind-address` is set to your IP address instead of `127.0.0.1`. If you change either of these items, restart MySQL.

NOTE: Your distribution may have a customized MySQL configuration file; in Mandriva, check `/etc/sysconfig/mysqld` for additional configuration.

Next Previous Contents