[mythtv-users] Database setup

R. G. Newbury newbury at mandamus.org
Tue Mar 25 03:38:39 UTC 2008


Harry Devine wrote:
> Michael Nguyen wrote:
>> Harry Devine wrote:
>>> Michael Nguyen wrote:
>>>> Harry Devine wrote:
>>>>
>>>> [snip]
>>>>> No need to apologize!  Easter fun is not a bad thing! 
>>>>> ;-)            I'll try this tonight when I get home from work.  
>>>>> I've created the mythconverg DB using mc.sql a few times already 
>>>>> during this process, so I'm pretty familiar with it.  One question 
>>>>> though:  in mc.sql, it gives privileges to the mythtv user as 
>>>>> "mythtv at localhost".  Do I have to do anything special such as add 
>>>>> "mythtv at HJDMyth" (my hostname) or anything like that?  Or will this 
>>>>> all just magically work now?
>>>>>
>>>>> Thanks again!
>>>>> Harry
>>>> The defaults for mythtv-setup are to connect back to "localhost".  
>>>> If you want to use a different hostname then specify that or add 
>>>> another entry.  It's probably easier to add another entry after 
>>>> running the mc.sql script:
>>>>
>>>> 1) Get a MySQL prompt as root
>>>> 2) Type the following:
>>>>
>>>> use mysql;
>>>> grant all privileges on mythconverg.* to mythtv@'%' identified by 
>>>> ('mythtv') with grant option;
>>>> flush privileges;
>>>>
>>>> This will leave the mythtv at localhost access and create another rule 
>>>> that will let mythtv connect from any location on your network.
>>>>
>>>> Michael
>>>>
>>>>
>>>>
>>>>
>>> OK, I dropped the mythconverg database, recreated it, and got the 
>>> mysql prompt.  When I try to grant the privileges, here's what I get:
>>>
>>> mysql> grant all privileges on mythconverg.* to mythtv@'%' identified 
>>> by ('mythtv') with grant option;
>>> ERROR 1064 (42000): You have an error in your SQL syntax; check the 
>>> manual that corresponds to your MySQL server version for the right 
>>> syntax to use near '('mythtv') with grant option' at line 1
>>>
>>>
>>> What did I enter wrong?  I typed it exactly as you gave it to me, but 
>>> I'm not sure what's wrong there.
>>>
>> Woops...sorry.
>>
>> grant all privileges on mythconverg.* to mythtv@'%' identified by 
>> 'mythtv' with grant option;
>>
>> No ().
>>
>>
>> Michael
>>
> OK, that worked.  I was able to login to mysql and run that command.  I 
> ran all the way through the mythtv-setup, setup the capture cards, etc.  
> Then when I run mythfrontend and go into the Utilities/Setup.  I entered 
> my hosts IP address, and the mythtv user and password.  After I left 
> that screen, the front end goes away, and when I try to start it again, 
> it tells me that it cannot login to the database then asks me for the 
> information again.  I really don't want to put the root user in there at 
> this point.
> 
> If I try to login to mysql from a command line, I can as root, but not 
> as mythtv.  I don't use mythtv's normal password (i.e. "mythtv").  I 
> changed it so nobody can SSH into the box and cause any damage.  Just to 
> be safe.  Anyway, if I login to mysql using mythtv as both the username 
> and password, I can login.
> 
> So I guess I'm closer, and my next question is how do I change the 
> password in the mythconverg database for the mythtv user to be my normal 
> mythtv user password?  Or should I just use mythtv on the frontend for 
> the password and leave it alone?

It appears that you are now able to use mysql from the command line as 
the root user.

So try this:

mysql -u root -pyourpasswordhereorblankifyoudidnotsetone

(Note the space between the '-u' and the 'root'

mysql# use mysql;
mysql> select host,user,password from user;

which should give something like:
+-----------------------+----------+------------------+
| host                  | user     | password         |
+-----------------------+----------+------------------+
| localhost             | root     | 1b3ab4920bfa6d2a |
| localhost             | mythtv   | 0476fc026afffe24 |

Note that this depends upon /etc/hosts having the line:

127.0.0.1 localhost.localdomain localhost

If you do not see mythtv then something is wrong. Use the mc.sql script 
to create the user 'mythtv' and grant privileges to that user, and set 
the password (the 'identified by "mythtv"' clause).

Use ALSO need to have a 'real' user called mythtv if you want to run 
myth as a user and not as root (although mythbackend will be 'owned'  by 
root if you start it as a service, mythfrontend will always be 'owned' 
by a user, generally the 'mythtv' user. That user gets created outside 
of myth.

So you need TWO different mythtv users....one is the mysql user and the 
other is the 'usual' user...and it IS easiest if the password is the same.


Geoff





More information about the mythtv-users mailing list