Personal tools
You are here: Home Linux MythTV Onyx, a CentOS 6.x MySQL Server for MythTV
 

Onyx, a CentOS 6.x MySQL Server for MythTV

Created a dedecated MySQL server for use by MythTV backend and frontends

The MythTV MySQL database instance is shared by the front-end client and the back-end server. I've split the database into it's own VM so it can be maintained and backed up independently of the backend or the frontend. It lives on the same network segment as the backend and frontend. It is a simple VM.

The backup of the database can be performed from the backend using the mythtv back script ( /usr/share/mythtv/mythconverg_backup.pl).

Install MySQL server:

# yum install mysql-server

Enable and start the server:

# chkconfig mysqld on
# service mysqld start

Reattach the'mythtv' user, as this information is stored in the 'mysql' database (not the 'mythconverg' database).

$ mysql -u root 
mysql> CREATE database mythconverg;
mysql> ALTER database mythconverg  DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
mysql> \u mythconverg
mysql> grant all on mythconverg.* to mythtv@"%.lucidsolutions.co.nz" identified by "mythtv";
mysql> grant all on mythconverg.* to mythtv@"10.20.12.%" identified by "mythtv";
mysql> grant all on mythconverg.* to mythtv@"2406:e001:0001:2c8c:%" identified by "mythtv";
mysql> grant all on mythconverg.* to mythtv@"fd0c:898b:471c:000c:%" identified by "mythtv";
mysql> grant all on mythconverg.* to mythtv@localhost identified by "mythtv";
mysql> flush privileges;

Restore the old database. This done from the backend server using a backup prepared earlier.

# /usr/share/mythtv/mythconverg_restore.pl --hostname 10.20.12.5 --verbose

Update the '~mythtv/mysql.txt' on the backend so that it uses the new MySQL instance:

DBHostName=10.20.12.5
DBUserName=mythtv
DBPassword=mythtv
DBName=mythconverg
LocalHostName=black.lucidsolutions.co.nz

Firewall

Add IPv4 firewall rules to allow access to the MySQL server from the local database and monitoring server.

# MySQL
-A tcpIn -p tcp -m tcp --dport 3306 --source 10.20.12.0/24 -m state --state NEW -j ACCEPT
-A tcpIn -p tcp -m tcp --dport 3306 --source 10.20.11.3    -m state --state NEW -j ACCEPT

Links

 

Appendices

mysql startup message

# service mysqld start
Initializing MySQL database:  Installing MySQL system tables...
OK
Filling help tables...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h onyx.lucidsolutions.co.nz password 'new-password'

Alternatively you can run:
/usr/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd /usr/mysql-test ; perl mysql-test-run.pl

Please report any problems with the /usr/bin/mysqlbug script!

Restore

# /usr/share/mythtv/mythconverg_restore.pl --hostname 10.20.12.5 --verbose                            
Configuring environment:
  -    username: root
  -        HOME: /root
  - MYTHCONFDIR: /root/.mythtv

Parsing configuration files:
  - checking: /root/.mythtv/config.xml
     parsing: /root/.mythtv/config.xml
  - checking: /root/.mythtv/backuprc
     parsing: /root/.mythtv/backuprc

Applying command-line arguments.

Checking configuration.

No filename specified. Attempting to find the newest database backup.
Using database backup file:
/tmp/mythconverg-1299-20130824152557.sql.gz

Database Information:
         DBHostName: 10.20.12.5
             DBPort: 3306
         DBUserName: mythtv
         DBPassword: XXX
             DBName: mythconverg
        DBSchemaVer:
  DBBackupDirectory: /tmp
   DBBackupFilename: mythconverg-1299-20130824152557.sql.gz
      drop_database: no
    create_database: no

Executables:
       mysql_client: mysql
         uncompress: gzip -d

Miscellaneous:
    partial_restore: no
   restore_xmltvids: no
    change_hostname: no

Checking database.

Found 0 tables in the database.

Backup file is compressed.
 - Uncompressing backup file with IO::Uncompress::Gunzip.

Attempting to use supplied password for mysql command-line client.
Any [client] or [mysql] password specified in the MySQL options file will
take precedence.

Executing command:
'mysql' --defaults-extra-file='/tmp/b32MrCq9tH' --host='10.20.12.5' --port='3306' --user='mythtv' 'mythconverg'

mysql exited with status: 0

Restored 3820 of 3820 lines.

Successfully restored backup.
 
Document Actions