[Solved] Myth v31.0 fails to restore database - unable to connect to database.

Have a MythTV related problem? Ask for help from other MythTV users here.

Moderator: Forum Moderators

briggella
Junior
Posts: 38
Joined: Tue Jun 05, 2018 11:52 am
New Zealand

Re: Myth v31.0 fails to restore database - unable to connect to database.

Post by briggella »

Thought I would summarise the process finally used as it will be complicated to follow the posts at a later date. I am plagiarising the documentation heavily.
Creating the mythtv user
MythTV backend needs to run as its own user. This should be a system account. Create a user as follows:
sudo useradd --system mythtv
Users might want to add --groups cdrom,audio,video to the above.
Because of Changes to password authentication in Mysql now
Add this line to your /etc/mysql/mysql.conf.d/mysqld.cnf
default_authentication_plugin=mysql_native_password
In Ubuntu I added it to /etc/mysql/conf.d/mythtv.cnf and /etc/mysql/conf.d/mythconverg.cnf
MythTV Database Setup
Run these commands from the command line. The mysql command will prompt for your root database password, which you would have supplied during mysql installation. The mysql daemon must be running.
Note: If you are running mariadb you have to run this from a linux root prompt (e.g. sudo mysql -u root) and you will not need a root database password.
mysql -u root -p
create database mythconverg;
create user 'mythtv'@'%' identified by 'mythtv';
create user 'mythtv'@'localhost' identified by 'mythtv';
ALTER USER 'mythtv'@'%' IDENTIFIED BY 'mythtv';
ALTER USER 'mythtv'@'localhost' IDENTIFIED BY 'mythtv';
instead of
[set password for 'mythtv'@'%' = password('mythtv');]
[set password for 'mythtv'@'localhost' = password('mythtv');]
connect mythconverg;
grant all privileges on *.* to 'mythtv'@'%' with grant option;
grant all privileges on *.* to 'mythtv'@'localhost' with grant option;
flush privileges;
exit;
Run the following command to set up time zone tables:
mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql
Ignore warnings like "Warning: Unable to load '/usr/share/zoneinfo/iso3166.tab' as time zone. Skipping it.".
Run mythtv-setup. This will automatically create your database or upgrade your previous mythconverg database schema to the latest version:
mythtv-setup
At this point I was unable to get into the database as Myth so I assumed something had gone wrong with the grants. Repeated the grant command for all privileges, checked all the config.xml files were the same, one was missing from mythtv’s home directory and I then tried the database restore again and then it worked. Run mythtv-setup with network parameters and the frontend but failed to connect. All the bind addresses were set to 0.0.0.0. Eventually I noted a comment about Frontend needing to be localhost and then we connected. Just need to sort tuners, remote control etc but that is another story.

Thank you for the help once again.
Post Reply