Mailing List Archive

Can't connect to database
Hi All,

I have just updated Xubutu on my server and backend computer.

I also updated MythTV, from 0.29 to 0.31 (via an incremental 0.30 step).
This is because the idea of "Greatly improved Channel Scanning" was too
much to resist (I've not been able to use Live TV on Myth for months).

After all of this, I've tried to run, "sudo mythtv-setup" and just ger
presented with a "Waiting for database" screen.

My only lead on solving this is one of the files that the Xubuntu update
wanted to replace. It was mysqld.cnf

I saved a copy of the changes between the old and new files (see below).
Does this help at all, or is it a blind alley?

And if the text below is a blind alley, how can I check what's going on
with the database?

If any log are needed, please let me know where/how to find them.

Thanks,
Damian


--- /etc/mysql/mysql.conf.d/mysqld.cnf??? 2016-04-27 12:38:23.833446622
+0100
+++ /etc/mysql/mysql.conf.d/mysqld.cnf.dpkg-new??? 2019-08-19
10:38:44.000000000 +0100
@@ -1,10 +1,6 @@
?#
?# The MySQL database server configuration file.
?#
-# You can copy this to one of:
-# - "/etc/mysql/my.cnf" to set global options,
-# - "~/.my.cnf" to set user-specific options.
-#
?# One can use all long options that the program supports.
?# Run program with --help to get a list of available options and with
?# --print-defaults to see which it would actually understand and use.
@@ -12,93 +8,70 @@
?# For explanations see
?# http://dev.mysql.com/doc/mysql/en/server-system-variables.html

-# This will be passed to all mysql clients
-# It has been reported that passwords should be enclosed with ticks/quotes
-# escpecially if they contain "#" chars...
-# Remember to edit /etc/mysql/debian.cnf when changing the socket location.
-
?# Here is entries for some specific programs
?# The following values assume you have at least 32M ram

-[mysqld_safe]
-socket??? ??? = /var/run/mysqld/mysqld.sock
-nice??? ??? = 0
-
?[mysqld]
?#
?# * Basic Settings
?#
?user??? ??? = mysql
-pid-file??? = /var/run/mysqld/mysqld.pid
-socket??? ??? = /var/run/mysqld/mysqld.sock
-port??? ??? = 3306
-basedir??? ??? = /usr
-datadir??? ??? = /var/lib/mysql
-tmpdir??? ??? = /tmp
-lc-messages-dir??? = /usr/share/mysql
-skip-external-locking
+# pid-file??? = /var/run/mysqld/mysqld.pid
+# socket??? = /var/run/mysqld/mysqld.sock
+# port??? ??? = 3306
+# datadir??? = /var/lib/mysql
+
+
+# If MySQL is running as a replication slave, this should be
+# changed. Ref
https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_tmpdir
+# tmpdir??? ??? = /tmp
?#
?# Instead of skip-networking the default is now to listen only on
?# localhost which is more compatible and is not less secure.
-# bind-address??? ??? = 127.0.0.1
+bind-address??? ??? = 127.0.0.1
?#
?# * Fine Tuning
?#
?key_buffer_size??? ??? = 16M
-max_allowed_packet??? = 16M
-thread_stack??? ??? = 192K
-thread_cache_size?????? = 8
+# max_allowed_packet??? = 64M
+# thread_stack??? ??? = 256K
+
+# thread_cache_size?????? = -1
+
?# This replaces the startup script and checks MyISAM tables if needed
?# the first time they are touched
?myisam-recover-options? = BACKUP
-#max_connections??????? = 100
-#table_cache??????????? = 64
-#thread_concurrency???? = 10
-#
-# * Query Cache Configuration
-#
-query_cache_limit??? = 1M
-query_cache_size??????? = 16M
+
+# max_connections??????? = 151
+
+# table_open_cache?????? = 4000
+
?#
?# * Logging and Replication
?#
?# Both location gets rotated by the cronjob.
+#
+# Log all queries
?# Be aware that this log type is a performance killer.
-# As of 5.1 you can enable the log at runtime!
-#general_log_file??????? = /var/log/mysql/mysql.log
-#general_log???????????? = 1
+# general_log_file??????? = /var/log/mysql/query.log
+# general_log???????????? = 1
?#
?# Error log - should be very few entries.
?#
?log_error = /var/log/mysql/error.log
?#
?# Here you can see queries with especially long duration
-#log_slow_queries??? = /var/log/mysql/mysql-slow.log
-#long_query_time = 2
-#log-queries-not-using-indexes
+# slow_query_log??? ??? = 1
+# slow_query_log_file??? = /var/log/mysql/mysql-slow.log
+# long_query_time = 2
+# log-queries-not-using-indexes
?#
?# The following can be used as easy to replay backup logs or for
replication.
?# note: if you are setting up a replication slave, see README.Debian about
?#?????? other settings you may need to change.
-#server-id??? ??? = 1
-#log_bin??? ??? ??? = /var/log/mysql/mysql-bin.log
-expire_logs_days??? = 10
+# server-id??? ??? = 1
+# log_bin??? ??? ??? = /var/log/mysql/mysql-bin.log
+# binlog_expire_logs_seconds??? = 2592000
?max_binlog_size?? = 100M
-#binlog_do_db??? ??? = include_database_name
-#binlog_ignore_db??? = include_database_name
-#
-# * InnoDB
-#
-# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
-# Read the manual for more InnoDB related options. There are many!
-#
-# * Security Features
-#
-# Read the manual, too, if you want chroot!
-# chroot = /var/lib/mysql/
-#
-# For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
-#
-# ssl-ca=/etc/mysql/cacert.pem
-# ssl-cert=/etc/mysql/server-cert.pem
-# ssl-key=/etc/mysql/server-key.pem
+# binlog_do_db??? ??? = include_database_name
+# binlog_ignore_db??? = include_database_name


_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Can't connect to database [ In reply to ]
On 03/05/2020 15:57, Damian wrote:
> Hi All,
>
> I have just updated Xubutu on my server and backend computer.
>
> I also updated MythTV, from 0.29 to 0.31 (via an incremental 0.30
> step). This is because the idea of "Greatly improved Channel Scanning"
> was too much to resist (I've not been able to use Live TV on Myth for
> months).
>
> After all of this, I've tried to run, "sudo mythtv-setup" and just ger
> presented with a "Waiting for database" screen.
>
> My only lead on solving this is one of the files that the Xubuntu
> update wanted to replace. It was mysqld.cnf
>
> I saved a copy of the changes between the old and new files (see
> below). Does this help at all, or is it a blind alley?
>
> And if the text below is a blind alley, how can I check what's going
> on with the database?
>
> If any log are needed, please let me know where/how to find them.
>
> Thanks,
> Damian

A bit more information ..

I've just noticed that my SliMP3 and Squeezebox can't connect to the
Logitech Media Server, which also runs on this server computer.

So, maybe Mysql isn't running?

Or maybe it just can't be connected to?

How can I check?

Thanks,
Damian

_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Can't connect to database [ In reply to ]
On Sun, 3 May 2020 15:57:04 +0100, you wrote:

>Hi All,
>
>I have just updated Xubutu on my server and backend computer.
>
>I also updated MythTV, from 0.29 to 0.31 (via an incremental 0.30 step).
>This is because the idea of "Greatly improved Channel Scanning" was too
>much to resist (I've not been able to use Live TV on Myth for months).
>
>After all of this, I've tried to run, "sudo mythtv-setup" and just ger
>presented with a "Waiting for database" screen.
>
>My only lead on solving this is one of the files that the Xubuntu update
>wanted to replace. It was mysqld.cnf
>
>I saved a copy of the changes between the old and new files (see below).
>Does this help at all, or is it a blind alley?
>
>And if the text below is a blind alley, how can I check what's going on
>with the database?
>
>If any log are needed, please let me know where/how to find them.
>
>Thanks,
>Damian

Is the "Waiting for database" message a GUI one from
mythtv-setup.real, or from the mythtv-setup wrapper script? The
wrapper script has had significant changes in v31 so it can shut down
mythbackend in the current environment. I would suggest manually
shutting down mythbackend (sudo systemctl stop mythtv-backend) and
then running mythtv-setup.real directly, to see if that works.

Also, mythtv-setup (and .real) should be run from a mythtv user,
rather than root.

Looking at the mysqld.cnf changes, I am not sure which of the two
diffed files is the one that is being loaded by MySQL or MariaDB. If
it is the +++ one, then the bindaddress=127.0.0.1 line has been
uncommented, so it could be overriding your real bindaddress line in
another settings file. Then your config.xml file might be using an
external IP address, and anything using that would not be able to
connect to the database.

BTW The config.xml file should be set connect using 127.0.0.1 or
localhost if it is on the same machine as the backend, as I believe
that using that setting tells MythTV programs to actually use a Unix
socket connection which is significantly faster and uses lower
resources than a TCP/IP connection to 127.0.0.1, which is in turn much
faster than using a TCP/IP connection to a real Ethernet port.
_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Can't connect to database [ In reply to ]
On 03/05/2020 17:27, Stephen Worthington wrote:
> On Sun, 3 May 2020 15:57:04 +0100, you wrote:
>
>> Hi All,
>>
>> I have just updated Xubutu on my server and backend computer.
>>
>> I also updated MythTV, from 0.29 to 0.31 (via an incremental 0.30 step).
>> This is because the idea of "Greatly improved Channel Scanning" was too
>> much to resist (I've not been able to use Live TV on Myth for months).
>>
>> After all of this, I've tried to run, "sudo mythtv-setup" and just ger
>> presented with a "Waiting for database" screen.
>>
>> My only lead on solving this is one of the files that the Xubuntu update
>> wanted to replace. It was mysqld.cnf
>>
>> I saved a copy of the changes between the old and new files (see below).
>> Does this help at all, or is it a blind alley?
>>
>> And if the text below is a blind alley, how can I check what's going on
>> with the database?
>>
>> If any log are needed, please let me know where/how to find them.
>>
>> Thanks,
>> Damian
> Is the "Waiting for database" message a GUI one from
> mythtv-setup.real, or from the mythtv-setup wrapper script?
Hi Stephen,

It was a GUI message/screen (with options to search or exit etc) after
running "sudo mythtv-setup"
> The
> wrapper script has had significant changes in v31 so it can shut down
> mythbackend in the current environment. I would suggest manually
> shutting down mythbackend (sudo systemctl stop mythtv-backend) and
> then running mythtv-setup.real directly, to see if that works.
OK, just tried that. It took me to the same GUI "Waiting for database to
start" screen, with Retry, Search, Setup and Exit options.

The options in Setup look just like they always have.
> Also, mythtv-setup (and .real) should be run from a mythtv user,
> rather than root.
OK. Thanks for letting me know. I feel like I've had problems with that
in the past, but I ran it as the user that last time.
> Looking at the mysqld.cnf changes, I am not sure which of the two
> diffed files is the one that is being loaded by MySQL or MariaDB.
This is my current /etc/mysql/mysql.conf.d/mysqld.cnf

#
# The MySQL database server configuration file.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html

# Here is entries for some specific programs
# The following values assume you have at least 32M ram

[mysqld]
#
# * Basic Settings
#
user??? ??? = mysql
# pid-file??? = /var/run/mysqld/mysqld.pid
# socket??? = /var/run/mysqld/mysqld.sock
# port??? ??? = 3306
# datadir??? = /var/lib/mysql


# If MySQL is running as a replication slave, this should be
# changed. Ref
https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_tmpdir
# tmpdir??? ??? = /tmp
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address??? ??? = 127.0.0.1
#
# * Fine Tuning
#
key_buffer_size??? ??? = 16M
# max_allowed_packet??? = 64M
# thread_stack??? ??? = 256K

# thread_cache_size?????? = -1

# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover-options? = BACKUP

# max_connections??????? = 151

# table_open_cache?????? = 4000

#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
#
# Log all queries
# Be aware that this log type is a performance killer.
# general_log_file??????? = /var/log/mysql/query.log
# general_log???????????? = 1
#
# Error log - should be very few entries.
#
log_error = /var/log/mysql/error.log
#
# Here you can see queries with especially long duration
# slow_query_log??? ??? = 1
# slow_query_log_file??? = /var/log/mysql/mysql-slow.log
# long_query_time = 2
# log-queries-not-using-indexes
#
# The following can be used as easy to replay backup logs or for
replication.
# note: if you are setting up a replication slave, see README.Debian about
#?????? other settings you may need to change.
# server-id??? ??? = 1
# log_bin??? ??? ??? = /var/log/mysql/mysql-bin.log
# binlog_expire_logs_seconds??? = 2592000
max_binlog_size?? = 100M
# binlog_do_db??? ??? = include_database_name
# binlog_ignore_db??? = include_database_name

> If
> it is the +++ one, then the bindaddress=127.0.0.1 line has been
> uncommented, so it could be overriding your real bindaddress line in
> another settings file.
I had my fingers crossed that the solution would be that simple. So, I
added # before the line, logged out and logged back in again.

I was still taken to the same waiting for database screen.

(I've taken the # back out of the bind-address. Let me know if it should
definitely be there).
> Then your config.xml file might be using an
> external IP address, and anything using that would not be able to
> connect to the database.
>
> BTW The config.xml file should be set connect using 127.0.0.1 or
> localhost if it is on the same machine as the backend, as I believe
> that using that setting tells MythTV programs to actually use a Unix
> socket connection which is significantly faster and uses lower
> resources than a TCP/IP connection to 127.0.0.1, which is in turn much
> faster than using a TCP/IP connection to a real Ethernet port.
This is my /etc/mythtv/config.xml

<Configuration>
? <Database>
??? <PingHost>1</PingHost>
??? <Host>192.168.0.4</Host>
??? <UserName>mythtv</UserName>
??? <Password>hidden</Password>
??? <DatabaseName>mythconverg</DatabaseName>
??? <Port>3306</Port>
? </Database>
? <WakeOnLAN>
??? <Enabled>0</Enabled>
??? <SQLReconnectWaitTime>0</SQLReconnectWaitTime>
??? <SQLConnectRetry>5</SQLConnectRetry>
??? <Command>echo 'WOLsqlServerCommand not set'</Command>
? </WakeOnLAN>
</Configuration>

The ip is set to the ip of the computer. That's the same as the ip
address that my frontends use. The server/backend doesn't even have a
screen most of the time (it does while I'm doing this), so I don't mind
how fast or slow the local frontend on the same machine is.

My main front end (different machine) is also unable to connect to the
backend database.

Any idea what else I can do?

Thanks for your help!
Damian
_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Can't connect to database [ In reply to ]
On 5/3/20 1:32 PM, Damian wrote:
>
>> If
>> it?is?the?+++?one,?then?the?bindaddress=127.0.0.1?line?has?been
>> uncommented,?so?it?could?be?overriding?your?real?bindaddress?line?in
>> another?settings?file.
> I had my fingers crossed that the solution would be that simple. So, I added?#?before?the?line,?logged?out?and?logged?back?in?again.
>
> I?was?still?taken?to?the?same?waiting?for?database?screen.
>
> (I've taken the # back out of the bind-address. Let me know if it should definitely?be?there).

Changes should never be made in /etc/mysql/mysql.conf.d/mysqld.cnf because they
can be overridden by a package maintainer.

Rather, create a file such as: /etc/mysql/mysql.conf.d/mythtv.cnf

In this specific case, to change the bind-address, add:

[mysqld]
bind-address=::

:: allows any IPv4 or IPv6 address to connect. You don't have to use that.

You must restart mysqld after making changes to its .cnf files (not just re-login).

You should verify that mysqld is running. With systemd, use: systemctl status mysqld

To verify access to the port: nmap -p 3306 --reason 192.168.0.4

Use the credentials in config.xml to test MythTV access to MySQL, e.g.

mysql --user=mythtv --host=192.168.0.4 --password=hidden mythconverg

If that doesn't work, then MythTV programs won't.



--
Bill
_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Can't connect to database [ In reply to ]
On 03/05/2020 19:54, Bill Meek wrote:
> On 5/3/20 1:32 PM, Damian wrote:
>>
>>> If
>>> it?is?the?+++?one,?then?the?bindaddress=127.0.0.1?line?has?been
>>> uncommented,?so?it?could?be?overriding?your?real?bindaddress?line?in
>>> another?settings?file.
>> I had my fingers crossed that the solution would be that simple. So,
>> I added?#?before?the?line,?logged?out?and?logged?back?in?again.
>>
>> I?was?still?taken?to?the?same?waiting?for?database?screen.
>>
>> (I've taken the # back out of the bind-address. Let me know if it
>> should definitely?be?there).
>
> Changes should never be made in /etc/mysql/mysql.conf.d/mysqld.cnf
> because they
> can be overridden by a package maintainer.
>
> Rather, create a file such as: /etc/mysql/mysql.conf.d/mythtv.cnf

Thanks Bill,

That file already existed, and had the bind-address commented out.

> In this specific case, to change the bind-address, add:
>
> [mysqld]
> bind-address=::
I replaced
#bind-address=0.0.0.0

with
bind-address=::

Restarted mysql (with sudo /etc/init.d/mysql restart)
And it worked!

I assume that bind-address=:: is 'too open'?

So, I tried
bind-address=127.0.0.1
but that didn't work.

However,
bind-address=192.168.0.4
did work!

Should I keep it like that?

Thanks Bill!!
_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Can't connect to database [ In reply to ]
On 5/3/20 3:56 PM, Damian wrote:
...
> I replaced
> #bind-address=0.0.0.0
>
> with
> bind-address=::
>
> Restarted mysql (with sudo /etc/init.d/mysql restart)
> And it worked!
>
> I assume that bind-address=:: is 'too open'?

Agreed, but "it's only TV".

> So, I tried
> bind-address=127.0.0.1
> but that didn't work.
>
> However,
> bind-address=192.168.0.4
> did work!
>
> Should I keep it like that?

Yes, I try not to argue with success ;).

--
Bill
_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Can't connect to database [ In reply to ]
On 04/05/2020 03:01, Bill Meek wrote:
> On 5/3/20 3:56 PM, Damian wrote:
> ...
>> I replaced
>> #bind-address=0.0.0.0
>>
>> with
>> bind-address=::
>>
>> Restarted mysql (with sudo /etc/init.d/mysql restart)
>> And it worked!
>>
>> I assume that bind-address=:: is 'too open'?
>
> Agreed, but "it's only TV".

:-) OK. I'm such a novice that I don't know what is getting opened up
and what isn't. If it's just the TV, then it doesn't matter at all.
>
>> So, I tried
>> bind-address=127.0.0.1
>> but that didn't work.
>>
>> However,
>> bind-address=192.168.0.4
>> did work!
>>
>> Should I keep it like that?
>
> Yes, I try not to argue with success ;).
>
Agreed. I'll keep it as it is.

Does any of this indicate what the Xubuntu update must have changed Bill?

I'm delighted that MythTV is working again, but my SliMP3 and Squeeze
Player still can't connect to the Logitech Media Server.

I assume that the problem was caused by one thing (maybe a change in
/etc/mysql/mysql.conf.d/mysqld.cnf). Changing
/etc/mysql/mysql.conf.d/mythtv.cnf has fixed MythTV. Would you have any
idea how I can fix the Logitech server connection?

I know that's completely off topic, but you're my best lead Bill! :-)

Thanks again,
Damian

_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org