Trying to Restore Dbase..

For discussion related to MythTV which doesn't belong in another forum.

Moderator: Forum Moderators

User avatar
bill6502
Developer
Posts: 2439
Joined: Fri Feb 07, 2014 5:28 pm
United States of America

Re: Trying to Restore Dbase..

Post by bill6502 »

If you'd like to use your old password, then yes change the ... IDENTIFIED BY 'mythtv'
value to it.
User avatar
diyhouse
Senior
Posts: 245
Joined: Mon Mar 31, 2014 9:42 am
Great Britain

Re: Trying to Restore Dbase..

Post by diyhouse »

Have run the 3 commands
ALTER USER 'mythtv'@'localhost' IDENTIFIED BY 'mythtv';
GRANT ALL ON mythconverg.* TO mythtv@localhost;
FLUSH PRIVILEGES;
And I am unable to connect to the sql Dbase using:-
mysql -h mythtv0 -u mythtv -p
BTW,.. should I close this thread as fixed, as technically I have restored the Dbase,.. I just cant use it :)
and open another thread?
User avatar
bill6502
Developer
Posts: 2439
Joined: Fri Feb 07, 2014 5:28 pm
United States of America

Re: Trying to Restore Dbase..

Post by bill6502 »

In the ALTER... above, you selected a password of 'mythtv'. Earlier you had some output that used 'lCxsunfHc'.
You can use either. Whatever's in config.xml must match what's in the DB. I was suggesting changing the
IDENTIFIED BY 'mythtv'. Perhaps you still want the lC.... one. Your choice.
white_haired_uncle
Senior
Posts: 563
Joined: Thu Feb 23, 2023 8:55 pm
Location: Safe outside my gilded cage
United States of America

Re: Trying to Restore Dbase..

Post by white_haired_uncle »

diyhouse wrote:
Mon Jun 17, 2024 8:30 pm

And I am unable to connect to the sql Dbase using:-
mysql -h mythtv0 -u mythtv -p
Good. mysql is configured to listen on localhost ONLY, and not mythtv0, so that should never work. As long as you only have a FE/BE/DB on the same machine, you can just use localhost and all will be good.

Your problem is (almost certainly) the password for mythtv. Either

Code: Select all

ALTER USER 'mythtv'@'localhost' IDENTIFIED BY 'mythtv';
and use mythtv as the password in config.xml and on the CLI (again, using localhost), or

Code: Select all

ALTER USER 'mythtv'@'localhost' IDENTIFIED BY 'CurseYouRedBaron';
and use CurseYouRedBaron as the password in config.xml and on the CLI.
User avatar
diyhouse
Senior
Posts: 245
Joined: Mon Mar 31, 2014 9:42 am
Great Britain

Re: Trying to Restore Dbase..

Post by diyhouse »

Your problem is (almost certainly) the password for mythtv. Either
Oops,.. Light bulb moment!!,. I did not realise the following statement:-
ALTER USER 'mythtv'@'localhost' IDENTIFIED BY 'mythtv';
actuall reset the passwd to!!,..

I did not appreciate "IDENTIFIED BY 'mythtv';" was actually a way of saying 'set passwd',.. what a muppet I was!!
Sorry guys for my misunderstanding here.

I have reset the passwd,. using the ALTER statement,.. so I am 100% sure what my passwd is set to,
<cut>
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> ALTER USER 'mythtv'@'localhost' IDENTIFIED BY 'KCx22fHc';
Query OK, 0 rows affected (0.23 sec)

mysql> quit
Bye
If I now try to login with the new passwd, I get
mark@mythtv0:~$ mysql -h mythtv0 -u mythtv -pKCx22fHc
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 2003 (HY000): Can't connect to MySQL server on 'mythtv0:3306' (111)
mark@mythtv0:~$ mysql -h mythtv1 -u mythtv -pKCx22fHc
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 2005 (HY000): Unknown MySQL server host 'mythtv1' (-3)
mark@mythtv0:~$
and trying the wrong m/c gives a different error,.. so it would appear to be an access isssue into SQL...
I have also tried the grant and flush statements as root SQL,.. but mythtv user is still unable to login

Thankyou for your help so far guys...
white_haired_uncle
Senior
Posts: 563
Joined: Thu Feb 23, 2023 8:55 pm
Location: Safe outside my gilded cage
United States of America

Re: Trying to Restore Dbase..

Post by white_haired_uncle »

mysql -h mythtv0 -u mythtv -pKCx22fHc

Again, never going to work because mysql is ONLY LISTENING ON localhost.
User avatar
diyhouse
Senior
Posts: 245
Joined: Mon Mar 31, 2014 9:42 am
Great Britain

Re: Trying to Restore Dbase..

Post by diyhouse »

but,..
mysql -u mythtv -pKCx22fHc
logs me in to sql,.. Confused,..
white_haired_uncle
Senior
Posts: 563
Joined: Thu Feb 23, 2023 8:55 pm
Location: Safe outside my gilded cage
United States of America

Re: Trying to Restore Dbase..

Post by white_haired_uncle »

Without the -h mythtv0 it's probably either using localhost, or a filesystem socket (used to be filesystem, though I don't see one on my system now).

With the -h mythtv0 it's going to use a TCP socket to connect to port 3306 on the IP of mythtv0, but nothing is listening on that IP/port. Look at

Code: Select all

netstat -an | grep 3306
, and you'll see that it is ONLY listening on 127.0.0.1 (localhost). If it said 0.0.0.0:3306 that would mean you could use any (IPv4) port to connect, so -h mythtv0 would work (you could add bind-address=* to /etc/mysql/conf.d/mythtv.cnf if you wanted it to work this way).
User avatar
diyhouse
Senior
Posts: 245
Joined: Mon Mar 31, 2014 9:42 am
Great Britain

Re: Trying to Restore Dbase..

Post by diyhouse »

Hi guys,..
Last login: Tue Jun 18 09:22:41 2024 from 192.168.3.40
mark@mythtv0:~$ netstat -an | grep 3306
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:33060 0.0.0.0:* LISTEN
As said to start with,. this is a clean install ubuntu 24.04 (basic desktop install ), only updates applied,.. and no other tweaking,.. yet.
BTW why '33060' ?
Which route do I take? ie what is the correct way to address this issue
Many thanks,
User avatar
bill6502
Developer
Posts: 2439
Joined: Fri Feb 07, 2014 5:28 pm
United States of America

Re: Trying to Restore Dbase..

Post by bill6502 »

In your initial post, the error message showed a password of: lCxsunfHc but in the posts just above KCx22fHc is used.

What does the backend log show? Put it at poastebin.com and a link to it here.
User avatar
diyhouse
Senior
Posts: 245
Joined: Mon Mar 31, 2014 9:42 am
Great Britain

Re: Trying to Restore Dbase..

Post by diyhouse »

KCx22fHc is my database passwd..

I will change later,.. once I have a solution.. and when I know how to reset things...
what I did not appreciate,.. as I said earlier, is the ' IDENTIFIED BY 'mythtv';' is another way of say set_passwd_to.
white_haired_uncle
Senior
Posts: 563
Joined: Thu Feb 23, 2023 8:55 pm
Location: Safe outside my gilded cage
United States of America

Re: Trying to Restore Dbase..

Post by white_haired_uncle »

So your /home/mythtv/.mythtv/config.xml contains this, like it should?

Code: Select all

    <Host>localhost</Host>
    <UserName>mythtv</UserName>
    <Password>KCx22fHc</Password>
    <DatabaseName>mythconverg</DatabaseName>
    <Port>3306</Port>
Last edited by white_haired_uncle on Tue Jun 18, 2024 7:31 pm, edited 1 time in total.
User avatar
bill6502
Developer
Posts: 2439
Joined: Fri Feb 07, 2014 5:28 pm
United States of America

Re: Trying to Restore Dbase..

Post by bill6502 »

@diyhouse, To be clear, the issue at this time is that the backend isn't starting. Right?

This would display the Password lines of all config.xml files: sudo find / -name "config.xml" -exec grep "<Password>" {} \;

The backend log would locate which directory is in use when it starts.
User avatar
diyhouse
Senior
Posts: 245
Joined: Mon Mar 31, 2014 9:42 am
Great Britain

Re: Trying to Restore Dbase..

Post by diyhouse »

and backend log looks like this

Code: Select all

https://pastebin.com/BpPXtBSz
User avatar
bill6502
Developer
Posts: 2439
Joined: Fri Feb 07, 2014 5:28 pm
United States of America

Re: Trying to Restore Dbase..

Post by bill6502 »

Code: Select all

N thread_unknown mythdirs.cpp:235 (InitializeMythDirs) Using configuration directory = /home/mythtv/.mythtv
E CoreContext mythdbparams.cpp:43 (IsValid) DBHostName is not set in config.xml
E CoreContext mythdbcon.cpp:247 (OpenDatabase) [DBManager0] Unable to connect to database!
E CoreContext mythdbcon.cpp:248 (OpenDatabase) Driver error was [1/1045]:#012QMYSQL: Unable to connect#012Database error was:#012Access denied for user 'mythtv'@'localhost' (using password: YES)
The config.xml file in play here is under /home/mythtv/.mythtv (the 1st message above).

The 2nd line above is odd and also suggests a config.xml issue, white_haired_uncle's lines should appear in that file.

Since the DB restore worked using your user's config.xml file and the backend doesn't start with the mythtv user's
information, that suggests multiple config.xml files. This will locate all config.xml files and tell you if they're a
file or a link: sudo find / -name "config.xml" -exec ls -ld {} \;
Last edited by bill6502 on Wed Jun 19, 2024 3:38 am, edited 1 time in total.
Reason: Deleted file/links comment
Post Reply