mythtv backend opensuse 13.1 unable to connect to database

It looks like lots of users have trouble with MythTV and Mariadb. My error looks a bit different that what I’ve seen posted. Here is the console output from mythtv-setup with the error message highlighted in red.

mythtv@linux-wh01:~> whoami
mythtv
mythtv@linux-wh01:~> /usr/bin/myth-startup
bash: /usr/bin/myth-startup: No such file or directory
mythtv@linux-wh01:~> /usr/bin/mythtv-setup
2013-12-26 00:06:58.747697 I Setup Interrupt handler
2013-12-26 00:06:58.747706 I Setup Terminated handler
2013-12-26 00:06:58.747709 I Setup Segmentation fault handler
2013-12-26 00:06:58.747711 I Setup Aborted handler
2013-12-26 00:06:58.747713 I Setup Bus error handler
2013-12-26 00:06:58.747715 I Setup Floating point exception handler
2013-12-26 00:06:58.747718 I Setup Illegal instruction handler
2013-12-26 00:06:58.747721 I Setup Real-time signal 0 handler
2013-12-26 00:06:58.747763 C mythtv-setup version: tag: v0.27 [317d5b7] MythTV, Open Source DVR
2013-12-26 00:06:58.747766 C Qt version: compile: 4.8.5, runtime: 4.8.5
2013-12-26 00:06:58.747768 N Enabled verbose msgs: general
2013-12-26 00:06:58.747773 N Setting Log Level to LOG_INFO
2013-12-26 00:06:58.747864 N Using runtime prefix = /usr
2013-12-26 00:06:58.747870 N Using configuration directory = /home/mythtv/.mythtv
2013-12-26 00:06:58.747905 I Assumed character encoding: en_US.UTF-8
2013-12-26 00:06:58.747907 I Added logging to the console
2013-12-26 00:06:58.748159 N Empty LocalHostName.
2013-12-26 00:06:58.748162 I Using localhost value of linux-wh01
2013-12-26 00:06:58.773387 E Unable to connect to database!
2013-12-26 00:06:58.773400 E Driver error was [1/1045]:
QMYSQL: Unable to connect
Database error was:
Access denied for user ‘mythtv’@‘linux-wh01’ (using password: YES)

2013-12-26 00:06:58.809593 N Desktop video mode: 1920x1200 59.950 Hz
2013-12-26 00:06:58.892647 E LIRC: Failed to connect to Unix socket ‘/var/run/lirc/lircd’
eno: No such file or directory (2)
2013-12-26 00:06:58.892708 E JoystickMenuThread: Joystick disabled - Failed to read /home/mythtv/.mythtv/joystickmenurc
2013-12-26 00:06:58.892723 I UDPListener: Enabling
2013-12-26 00:06:58.893698 I Binding to UDP 127.0.0.1:0
2013-12-26 00:06:58.893725 I Binding to UDP 192.168.123.59:0
2013-12-26 00:06:58.893744 I Binding to UDP 192.168.123.255:0
2013-12-26 00:06:58.904346 I Using Frameless Window
2013-12-26 00:06:58.904367 I Using Full Screen Window
2013-12-26 00:06:58.906342 I Using the Qt painter
2013-12-26 00:06:58.969674 N Setting QT default locale to en_US
2013-12-26 00:06:58.970842 I Starting mythlogserver
2013-12-26 00:06:58.971078 I Starting process manager
2013-12-26 00:06:58.971116 I Starting process signal handler
2013-12-26 00:06:58.972146 I Starting IO manager (read)
2013-12-26 00:06:58.972275 I Starting IO manager (write)
2013-12-26 00:06:59.051423 I MythUIWebBrowser: Loading css from - file:///usr/share/mythtv/themes/default/htmls/mythbrowser.css
2013-12-26 00:06:59.051686 E MythUIWebBrowser: failed to find our parent screen
2013-12-26 00:06:59.051756 I MythUIWebBrowser: enabling plugins
2013-12-26 00:06:59.071310 I Added logging to mythlogserver at TCP:35327
2013-12-26 00:06:59.183231 I System Locale (en_US), Country (US), Language (en)
2013-12-26 00:07:03.629942 E Error Loading en_us translation for module mythfrontend
2013-12-26 00:07:03.783676 I Starting mythlogserver
2013-12-26 00:07:05.337602 A User cancelled database configuration
2013-12-26 00:07:05.342908 E Failed to init MythContext, exiting.

I’ve done a few variants of the mysql.txt, whith the current one being:

mythtv@linux-wh01:~> cd .mythtv
mythtv@linux-wh01:~/.mythtv> ls
Cache-mythtv-setup-linux-wh01 config.xml mysql.txt MythBrowser themecache
mythtv@linux-wh01:~/.mythtv> cat mysql.txt
DBHostName=linux-wh01

By default, Myth tries to ping the DB host to see if it exists.

If your DB host or network doesn’t accept pings, set this to no:

DBHostPing=no

DBHostName=linux-wh01
DBUserName=mythtv
DBName=mythconverg
DBPassword=mythtv

Set the following if you want to use something other than this

machine’s real hostname for identifying settings in the database.

This is useful if your hostname changes often, as otherwise you

will need to reconfigure mythtv (or futz with the DB) every time.

TWO HOSTS MUST NOT USE THE SAME VALUE

#LocalHostName=MYCOOLMYTHTVHOST

If you want your frontend to be able to wake your MySQL server

using WakeOnLan, have a look at the following settings:

The time the frontend waits (in seconds) between reconnect tries.

This should be the rough time your MySQL server needs for startup

#WOLsqlReconnectWaitTime=0

This is the number of retries to wake the MySQL server

until the frontend gives up

#WOLsqlConnectRetry=5

This is the command executed to wake your MySQL server.

#WOLsqlCommand=echo ‘WOLsqlServerCommand not set’

You can see I created the user mythtv. I’m running of out idea here.

“Access denied for user ‘mythtv’@‘linux-wh01’ (using password: YES)”
→ looks like wrong password or username.

Can you connect to MySQL/MariaDB with the cli client (mysql) and the username and password in mysql.txt ?

Hendrik

i think the answer to that is negative, but isn’t the setup supposed to create the account?


mythtv@linux-wh01:~> mysql -u mythtv -p
Enter password:
ERROR 1045 (28000): Access denied for user ‘mythtv’@‘localhost’ (using password: YES)
mythtv@linux-wh01:~>

I will try to figure out to set up an account and see what happens.

I tried to add the user from the console.

mythtv@linux-wh01:~> mysql -u mythtv -p
Enter password:
ERROR 1045 (28000): Access denied for user ‘mythtv’@‘localhost’ (using password: YES)
mythtv@linux-wh01:~> mysql -u root
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 32
Server version: 5.5.33-MariaDB openSUSE package

Copyright (c) 2000, 2013, Oracle, Monty Program Ab and others.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

MariaDB (none)]> create user ‘mythtv’@‘localhost’ identified by ‘mythtv’;
ERROR 1396 (HY000): Operation CREATE USER failed for ‘mythtv’@‘localhost’
MariaDB (none)]> drop user mythtv@localhost;
Query OK, 0 rows affected (0.00 sec)

MariaDB (none)]> create user mythtv@locakhost identified by ‘mythtv’;
Query OK, 0 rows affected (0.00 sec)

MariaDB (none)]> exit
Bye
mythtv@linux-wh01:~> mysql -u mythtv -p
Enter password:
ERROR 1045 (28000): Access denied for user ‘mythtv’@‘localhost’ (using password: YES)
mythtv@linux-wh01:~>

@locakhost
→ I hope, that this is a typo.

After creating / deleting a login, you should issue a “flush privileges;” command. This persists the changes and makes them “visible” for all connections, if it doesn’t work automatically.

Otherwise you could create the account without the @hostname part. This way you avoid problems with the hostnames / IP addresses; but be aware that this allows remote logins.

Hendrik

Unfortunately I did enter locakhost. :frowning: You have a good eye.

For someone reading this that might be as unskilled in sql as me, the command to list users is:
mysql> **select * from mysql.user;

**Thus I double checked to make sure the user account was entered incorrectly. **** that sysadmin…oh wait, that’s me.]

And to delete a user:

DROP USER user@host;

I will now add mythtv again, attempting to avoid typos. Forgive me for posting the obvious commands here, but I will probably end up using this thread again as a reference.

**CREATE USER user@host IDENTIFIED BY ‘password’;
****FLUSH PRIVILEGES;
**

I am now connecting to the database. That is certainly one small but very important step. I su’d into the mythtv account and also did a cd ~mythtv to make sure it read the start up file. Here is the result:

mythtv@linux-wh01:~> whoami
mythtv
mythtv@linux-wh01:~> /usr/bin/mythtv-setup
No protocol specified
mythtv-setup: cannot connect to X server :0
mythtv@linux-wh01:~>

Note I am using a console. That is, I am not SSHing from another computer, so there should be an issue with X.

However, just to be sure, I logged in as the mythtv user and this time I couldn’t log into mysql.

mythtv@linux-wh01:~> /usr/bin/mythtv-setup
2013-12-28 00:25:00.991108 I Setup Interrupt handler
2013-12-28 00:25:00.991117 I Setup Terminated handler
2013-12-28 00:25:00.991119 I Setup Segmentation fault handler
2013-12-28 00:25:00.991121 I Setup Aborted handler
2013-12-28 00:25:00.991123 I Setup Bus error handler
2013-12-28 00:25:00.991126 I Setup Floating point exception handler
2013-12-28 00:25:00.991128 I Setup Illegal instruction handler
2013-12-28 00:25:00.991131 I Setup Real-time signal 0 handler
2013-12-28 00:25:00.991175 C mythtv-setup version: tag: v0.27 [317d5b7] MythTV, Open Source DVR
2013-12-28 00:25:00.991178 C Qt version: compile: 4.8.5, runtime: 4.8.5
2013-12-28 00:25:00.991180 N Enabled verbose msgs: general
2013-12-28 00:25:00.991185 N Setting Log Level to LOG_INFO
2013-12-28 00:25:00.991280 N Using runtime prefix = /usr
2013-12-28 00:25:00.991286 N Using configuration directory = /home/mythtv/.mythtv
2013-12-28 00:25:00.991340 I Added logging to the console
2013-12-28 00:25:00.991331 I Assumed character encoding: en_US.UTF-8
2013-12-28 00:25:00.991589 N Empty LocalHostName.
2013-12-28 00:25:00.991592 I Using localhost value of linux-wh01
2013-12-28 00:25:01.173127 E Unable to connect to database!
2013-12-28 00:25:01.173139 E Driver error was [1/1045]:
QMYSQL: Unable to connect
Database error was:
Access denied for user ‘mythtv’@‘linux-wh01’ (using password: YES)

2013-12-28 00:25:01.207263 N Desktop video mode: 1920x1200 59.950 Hz
2013-12-28 00:25:01.214290 I Starting mythlogserver
2013-12-28 00:25:01.214385 I Starting process manager
2013-12-28 00:25:01.214430 I Starting process signal handler
2013-12-28 00:25:01.214451 I Starting IO manager (read)
2013-12-28 00:25:01.215580 I Starting IO manager (write)
2013-12-28 00:25:01.288689 E LIRC: Failed to connect to Unix socket ‘/var/run/lirc/lircd’
eno: No such file or directory (2)
2013-12-28 00:25:01.288706 E JoystickMenuThread: Joystick disabled - Failed to read /home/mythtv/.mythtv/joystickmenurc
2013-12-28 00:25:01.288710 I UDPListener: Enabling
2013-12-28 00:25:01.288988 I Binding to UDP 127.0.0.1:0
2013-12-28 00:25:01.289013 I Binding to UDP 192.168.123.59:0
2013-12-28 00:25:01.289032 I Binding to UDP 192.168.123.255:0
2013-12-28 00:25:01.299520 I Using Frameless Window
2013-12-28 00:25:01.299535 I Using Full Screen Window
2013-12-28 00:25:01.300821 I Using the Qt painter
2013-12-28 00:25:01.314636 I Added logging to mythlogserver at TCP:35327
2013-12-28 00:25:01.356704 N Setting QT default locale to en_US
2013-12-28 00:25:01.434907 I MythUIWebBrowser: Loading css from - file:///usr/share/mythtv/themes/default/htmls/mythbrowser.css
2013-12-28 00:25:01.435129 E MythUIWebBrowser: failed to find our parent screen
2013-12-28 00:25:01.435188 I MythUIWebBrowser: enabling plugins
2013-12-28 00:25:01.571610 I System Locale (en_US), Country (US), Language (en)
2013-12-28 00:25:06.026578 I Starting mythlogserver
2013-12-28 00:25:08.125739 E Error Loading en_us translation for module mythfrontend
2013-12-28 00:25:22.525686 A User cancelled database configuration
2013-12-28 00:25:22.533447 E Failed to init MythContext, exiting.

So it looks like you can’t run mythtv-setup from a console window on another account even if you superusered into that account. Odd since I would bet gurus ssh and do this all the time. Anyway, now I am not coneecting again.

If this setup program needs X you could do “ssh -Y foreign_host” and start the mythtv-setup. This should send all graphical output to the ssh client machine and you don’t need a graphical desktop at the server.

Which mysql account(s) did you create?
“mythtv@localhost” is different from “mythtv@linux-wh01”.

Hendrik

I’ll save that trick for SSH, but right now I’m not tempting fate, so I will log into the mythtv user account.

I’ve now added both users, just to be sure. Mysql has a bit of difficulty parsing the hyphen in linux-wh01, so the command looks like
create user ‘mythtv’@‘linux-wh01’ identified by ‘mythtv’;
for the benefit of anyone else reading this. I also did the flush privileges command.

I used the select command to show all users and now have both mythtv@localhost and mythtv@linux-wh01 set up on mysql.
| localhost | mythtv |
| linux-wh01 | mythtv |
Those are cut and paste from the output of the mysql select command.

Here is the output from mythtv-setup:

mythtv@linux-wh01:~/.mythtv> /usr/bin/mythtv-setup
2013-12-28 14:47:31.841694 I Setup Interrupt handler
2013-12-28 14:47:31.841704 I Setup Terminated handler
2013-12-28 14:47:31.841706 I Setup Segmentation fault handler
2013-12-28 14:47:31.841708 I Setup Aborted handler
2013-12-28 14:47:31.841710 I Setup Bus error handler
2013-12-28 14:47:31.841713 I Setup Floating point exception handler
2013-12-28 14:47:31.841715 I Setup Illegal instruction handler
2013-12-28 14:47:31.841718 I Setup Real-time signal 0 handler
2013-12-28 14:47:31.841757 C mythtv-setup version: tag: v0.27 [317d5b7] MythTV, Open Source DVR
2013-12-28 14:47:31.841760 C Qt version: compile: 4.8.5, runtime: 4.8.5
2013-12-28 14:47:31.841762 N Enabled verbose msgs: general
2013-12-28 14:47:31.841770 N Setting Log Level to LOG_INFO
2013-12-28 14:47:31.841856 N Using runtime prefix = /usr
2013-12-28 14:47:31.841862 N Using configuration directory = /home/mythtv/.mythtv
2013-12-28 14:47:31.841916 I Added logging to the console
2013-12-28 14:47:31.841907 I Assumed character encoding: en_US.UTF-8
2013-12-28 14:47:31.842182 N Empty LocalHostName.
2013-12-28 14:47:31.842185 I Using localhost value of linux-wh01
2013-12-28 14:47:31.864857 E Unable to connect to database!
2013-12-28 14:47:31.864879 E Driver error was [1/1044]:
QMYSQL: Unable to connect
Database error was:
Access denied for user ‘mythtv’@‘linux-wh01’ to database ‘mythconverg’

2013-12-28 14:47:31.906846 N Desktop video mode: 1920x1200 59.950 Hz
2013-12-28 14:47:31.991550 E LIRC: Failed to connect to Unix socket ‘/var/run/lirc/lircd’
eno: No such file or directory (2)
2013-12-28 14:47:31.991610 E JoystickMenuThread: Joystick disabled - Failed to read /home/mythtv/.mythtv/joystickmenurc
2013-12-28 14:47:31.991640 I UDPListener: Enabling
2013-12-28 14:47:31.992601 I Binding to UDP 127.0.0.1:0
2013-12-28 14:47:31.992718 I Binding to UDP 192.168.123.59:0
2013-12-28 14:47:31.992788 I Binding to UDP 192.168.123.255:0
2013-12-28 14:47:32.003996 I Using Frameless Window
2013-12-28 14:47:32.004015 I Using Full Screen Window
2013-12-28 14:47:32.005520 I Using the Qt painter
2013-12-28 14:47:32.065730 I Starting mythlogserver
2013-12-28 14:47:32.067307 I Starting IO manager (write)
2013-12-28 14:47:32.067998 N Setting QT default locale to en_US
2013-12-28 14:47:32.069136 I Starting process signal handler
2013-12-28 14:47:32.069141 I Starting IO manager (read)
2013-12-28 14:47:32.069160 I Starting process manager
2013-12-28 14:47:32.154953 I MythUIWebBrowser: Loading css from - file:///usr/share/mythtv/themes/default/htmls/mythbrowser.css
2013-12-28 14:47:32.155179 E MythUIWebBrowser: failed to find our parent screen
2013-12-28 14:47:32.155240 I MythUIWebBrowser: enabling plugins
2013-12-28 14:47:32.169368 I Added logging to mythlogserver at TCP:35327
2013-12-28 14:47:32.287195 I System Locale (en_US), Country (US), Language (en)
2013-12-28 14:47:36.114240 E Error Loading en_us translation for module mythfrontend
2013-12-28 14:47:36.882279 I Starting mythlogserver
2013-12-28 14:47:39.178602 A User cancelled database configuration
2013-12-28 14:47:39.184823 E Failed to init MythContext, exiting.

For completeness, this is the current state of the mysql.txt file in the .mythtv directory:

mythtv@linux-wh01:~/.mythtv> cat mysql.txt
DBHostName=linux-wh01

By default, Myth tries to ping the DB host to see if it exists.

If your DB host or network doesn’t accept pings, set this to no:

DBHostPing=no

DBHostName=linux-wh01
DBUserName=mythtv
DBName=mythconverg
DBPassword=mythtv

Set the following if you want to use something other than this

machine’s real hostname for identifying settings in the database.

This is useful if your hostname changes often, as otherwise you

will need to reconfigure mythtv (or futz with the DB) every time.

TWO HOSTS MUST NOT USE THE SAME VALUE

#LocalHostName=MYCOOLMYTHTVHOST

If you want your frontend to be able to wake your MySQL server

using WakeOnLan, have a look at the following settings:

The time the frontend waits (in seconds) between reconnect tries.

This should be the rough time your MySQL server needs for startup

#WOLsqlReconnectWaitTime=0

This is the number of retries to wake the MySQL server

until the frontend gives up

#WOLsqlConnectRetry=5

This is the command executed to wake your MySQL server.

#WOLsqlCommand=echo ‘WOLsqlServerCommand not set’

I figured it might be useful to try to connect to the database outside of the mythtv-setup program:

mythtv@linux-wh01:~> mysql -u mythtv
ERROR 1045 (28000): Access denied for user ‘mythtv’@‘localhost’ (using password: NO)
mythtv@linux-wh01:~> mysql -u mythtv@linux-wh01
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 55
Server version: 5.5.33-MariaDB openSUSE package

Copyright (c) 2000, 2013, Oracle, Monty Program Ab and others.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

MariaDB (none)]> connect mythconverg
ERROR 1044 (42000): Access denied for user ‘’@‘localhost’ to database ‘mythconverg’
unknown [mythconverg]>

It looks to me as if the mythtv@linux-wh01 user does exist as far as musql is concerned, but not the database.

It doesn’t work this way. MySQL figures out the host part by itself, depending from which network/socket the client comes from.

You can try:

mysql -u mythtv -h linux-wh01 -p

After “-h” comes the name or IP address you want to use to connect to the database. “-p” tells the cli client, that you want to use a password.

Does the database mythconverg exists ? (“show databases;”) Otherwise create it (“create database mythtvconverg;”).
If yes, has the user mythtv@ the rights to access/use it ? (“show grants for mythtv@;”).
If the user has no rights, you may want to

grant all on mythconverg.* to mythtv@<hostname>;

.

Sometimes the guest logins cause strange auth errors (“Access denied for user ‘’@‘localhost’”), especially when you connect from localhost with an unknown/not existent user.
You can get rid of them:


delete from mysql.user where User='';
flush privileges;

Hendrik

At this point I can get the setup to run. Thanks for your help. I had to create the user and database. In addition, you need to add the time zone data to mysql. Here is a link with the instructions.
MySQL Time Zone Tables - MythTV Official Wiki
And for fun, mysql wasn’t running, which added more confusion since I couldn’t log into mysql at first. I fired it up again in yast services, but will keep an eye out for it not starting up upon boot up.

At this point, I consider the thread closed and again thank you for your help and patience. I’ll probably have other problems with mythtv, but hopefully those won’t be database related. [It would probably do me good to learn SQL anyway.]

I noticed some chatter around the net about dropping mariadb and going back to the official mysql. This seems like a bad idea and hopefully this thread will dissuade users from doing that. I wouldn’t consider going back to mysql breaking the distribution, but it is borderline to doing that. Better to be part of the solution and make mariadb work.