[mythtv-users] MythTV MySQL setup didn't work

Michael T. Dean mtdean at thirdcontact.com
Sun Jan 17 01:49:42 UTC 2010

On 01/16/2010 06:03 PM, emarkert at aim.com wrote:
>>> mysql -u root -p < /usr/share/doc/mythtv-docs-0.22/database/mc.sql
>>> needs to be
>>> mysql -u root -p mythconverg <
>>> /usr/share/doc/mythtv-docs-0.22/database/mc.sql
>>> and you likely would have needed to create the database first
>>> mysqladmin -uroot -p create mythconverg
> <Please don't top post on this list>
>> That is all incorrect. the mc.sql is precisely what creates the
>> database for you, along with setting the correct attributes that the
>> DB schema creation and upgrade path that mythbackend follow expects.
>> You do *not* need to create the DB first, and you definitely don't
>> want to run the DB creation script on the database it itself creates.
> Actually, it's not all wrong.  I answered the question.  The mysql commands I gave him are correct, and the DDL language in the mc.sql file will create the database as you mention, but if the database already exists it will skip that command.  

The problem is that if there's an existing database, there's a good
chance that the existing database is /not/ the right database--i.e. the
user is creating a new database into which to import a 0.21-fixes
database backup, but the distro/packages already created a 0.22-fixes
database schema.  (Note that mc.sql creates the database, not the
schema.)  If you import data from a different MythTV schema version into
MySQL, MySQL won't complain and it will silently corrupt data.

Therefore, it's important that no mythconverg database exists when you
run mc.sql--or at the very least that it's a completely empty
database(/empty schema).  In the event that the mythconverg database
doesn't exist, you can not specify a database name of mythconverg when
starting the mysql command-line client, as there's no mythconverg
database for the mysql client to use.

So, the only reason you needed to create the mythconverg database before
running the SQL script whose sole purpose is to create the mythconverg
database is because you put the mythconverg database name on the mysql
command line.  Generally, you'd run mc.sql with:

mysql -uroot -p < /path/to/mc.sql

and it would create the database for you.  See, also,


More information about the mythtv-users mailing list