<html><head></head><body><span class="viv-signature"></span><br><br>On
Wednesday 07 August 2024 09:27:57 AM (-05:00), James Abernathy
wrote:<br><br><blockquote style="margin: 0 0 0.80ex; border-left: #0000FF
2px solid; padding-left: 1ex"><div dir="ltr">On my test mythtv backend I'm
trying to set up to use ntfy.sh. I seem to have a permissions issue that
I'm not able to fix.<div><br></div><div>I set up my database using the
following mysql
instructions:</div><div><br></div><div>mythtv_password=mythtv <br></div><div>sudo
mysql -uroot << ENDOFSCRIPTINPUT<br>CREATE DATABASE IF NOT EXISTS
mythconverg;<br>CREATE USER IF NOT EXISTS 'mythtv'@'%' IDENTIFIED BY
'mythtv';<br>CREATE USER IF NOT EXISTS 'mythtv'@'localhost' IDENTIFIED BY
'mythtv';<br>SET PASSWORD FOR 'mythtv'@'%' =
PASSWORD('$mythtv_password');<br>SET PASSWORD FOR 'mythtv'@'localhost' =
PASSWORD('$mythtv_password');<br>CONNECT mythconverg;<br>GRANT ALL
PRIVILEGES ON *.* TO 'mythtv'@'%' WITH GRANT OPTION;<br>GRANT ALL
PRIVILEGES ON *.* TO 'mythtv'@'localhost' WITH GRANT OPTION;<br>FLUSH
PRIVILEGES;<br>EXIT<br>ENDOFSCRIPTINPUT<br></div><div><br></div><div>This
works for using mythtv backend and frontend. However, when running my
backup script I see:</div><div><br></div><div><span
style="font-family:monospace;"><span style="color:rgb(0, 0,
0);">[mythtv@nucboxg3 ~]$ mythtv-database-backup.sh
</span><br>/usr/bin/mariadb-check: Got error: 1045: Access denied for
user 'mythtv'@'localhost' (using password: NO) when trying to connect<br>
<br></span></div><div><span style="font-family:monospace;">This is the
script that I can either run as user mythtv normally or in a systemd
service with a timer. When run by systemd everything works except for the
mariadb-check so until I checked the logs I didn't know it wasn't working
because I was getting the backups and notifications.</span></div><div><span
style="font-family:monospace;"> </span></div><div>#!/bin/sh<br>#
/etc/cron.weekly/mythtv-database script - check and backup mythconverg
tables<br># Copyright 2005/12/02 2006/10/08 Paul Andreassen<br>#
2010
Mario Limonciello<br>set -e
-u<br>DBNAME="mythconverg"<br>USER=mythtv<br>BKUP_LOG=/tmp/backup-mythconverg.log<br>export
MYTHCONFDIR=/home/$USER/.mythtv/<br>/usr/bin/mariadb-check -s
$DBNAME<br>/usr/local/bin/<a
href="http://optimize_mythdb.pl">optimize_mythdb.pl</a> | grep -v
"^Analyzed:" 2>&1 >> $BKUP_LOG<br>sudo --preserve-env
--user=$USER /usr/share/mythtv/<a
href="http://mythconverg_backup.pl">mythconverg_backup.pl</a> --rotate=5
--verbose 2>&1 >> $BKUP_LOG<br>if [ $? -eq 0 ]; then<br>
MSG="nucboxg3 $DBNAME Checked and Backed Up,
RC=$?"<br>else<br> MSG="nucboxg3 $DBNAME Back Up Failed,
RC=$?"<br>fi<br>cd /mythtv/db_backups<br>ls -l --directory --block-size=K *
| tail -10 >> $BKUP_LOG<br>bash <(curl -d "$MSG" <a
href="http://ntfy.sh/jfa-mythtv-database-backup">ntfy.sh/jfa-mythtv-database-backup</a>)<br></div><div><br></div><div>What
am I missing?</div><div><br></div><div>Jim
A</div></div></blockquote><div><br></div><span style="font-size:
medium;">The /usr/bin/mariadb-check -s $DBNAME above has no password.
I assume your .service file has</span><div><font size="3">a User=mythtv
line in it.</font></div><div><font size="3"><br></font><div><font
size="3">Test: /</font><span style="font-size:
medium;">usr/bin/mariadb-check</span><span style="font-size:
medium;"> mythconverg </span><span style="font-size: medium;">as
that user. Maybe your</span></div><div><span style="font-size:
medium;">user has a .my.cnf file with the password etc. and user mythtv
doesn't?</span></div><div><div><blockquote style="margin: 0 0 0.80ex;
border-left: #0000FF 2px solid; padding-left: 1ex"><div
dir="ltr"><div></div></div></blockquote><span
class="viv-signature-below"><br>-- <br>Bill</span></div></div></div></body></html>