Category:MySQL

From MythTV Official Wiki
(Redirected from MySql)
Jump to: navigation, search
Wikipedia-logo-en.png
Wikipedia has an article on:

This is the Database system used with MythTV. MySQL is a very versatile database system, used with many projects and web sites. For more info on MySQL itself, see http://www.mysql.com. For info on the MySQL database used with Myth, read on.

Database Schema

If you run into trouble with some of your MythTV tables or are looking for information on how the system is stored, browse the Database Schema for more information.

Questions and Answers

Q: My database seems broken and/or I see errors in the backend log file about a table "marked as crashed and should be repaired."
A: Run the optimize_mythtv.pl script found in the contrib directory of the source distribution. Packages may place the script in various locations. Generally you can find the script with:

locate optimize_mythdb.pl

To run the script from the directory containing the optimize_mythdb.pl script:

./optimize_mythdb.pl

or

perl ./optimize_mythdb.pl

You may want to set a cron job to run the optimize_mythdb.pl script as often as once per day, as described in the comments at the top of the script. You should run the script at least once per month (whether manually or in a cron job) and running it at least once per week may make your system more responsive.

Q: When running mysqlcheck I get the error message "Access denied for user ..."
A: The problem may be that you are using the wrong password. The following commands will change the mysql password to "mythtv":

# mysql -u root -p mysql
myqsl> GRANT ALL PRIVILEGES ON *.* TO 'mythtv'@'localhost'
    -> IDENTIFIED BY 'mythtv' WITH GRANT OPTION;
mysql> UPDATE user SET Password=PASSWORD('mythtv') WHERE user='mythtv';
mysql> FLUSH PRIVILEGES;
mysql> quit

Note that you will have to change the database password in the mythtv setup to "mythtv" once you get it running again.

Q: I'm getting a SQL error from mythbackend when upgrading. What does that mean?
A: Try using perror to get more information

2004-05-25 22:56:24 Upgrading to schema version 1046
2004-05-25 22:56:24 Upgrading to schema version 1047
DB Error (Performing database upgrade):
Query was:
ALTER TABLE record ADD COLUMN search INT UNSIGNED NOT NULL DEFAULT 0;
Driver error was [2/-1]:
QMYSQL3: Unable to execute query
Database error was:
Error writing file './mythconverg/#sql-785_2.frm' (Errcode: 28)

For future reference you can use perror with the mysql error number:
$ perror 28
Error code  28:  No space left on device

The access credentials used by MythTV will be found in your config.xml in the <Database> stanza, as shown below:

<Configuration>
  <UPnP>
    <UDN>
      <MediaRenderer>xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx</MediaRenderer>
    </UDN>
  </UPnP>
  <LocalHostName>my-unique-identifier-goes-here</LocalHostName>
  <Database>
    <UserName>mythtv</UserName>
    <PingHost>1</PingHost>
    <Host>127.0.0.1</Host>
    <DatabaseName>mythconverg</DatabaseName>
    <Password>mythtv</Password>
    <Port>3306</Port>
  </Database>
  <WakeOnLan>
    <Enabled>0</Enabled>
    <SQLReconnectWaitTime>0</SQLReconnectWaitTime>
    <SQLConnectRetry>5</SQLConnectRetry>
    <Command>echo 'WOLsqlServerCommand not set'</Command>
  </WakeOnLan>
</Configuration>

If running versions prior to 0.26, this information will instead be contained within mysql.txt:

DBHostName=localhost
DBUserName=mythtv
DBName=mythconverg
DBPassword=mythtv

Subcategories

This category has only the following subcategory.