[mythtv-users] mysql mythtv user issue - fixes/31

Bill Meek keemllib at gmail.com
Thu Feb 13 01:40:33 UTC 2020

On 2/12/20 6:11 PM, Tim Pletcher wrote:
>  From the MySQL reference manual for both 5.7 & 8 (link
> <https://dev.mysql.com/doc/refman/5.7/en/alter-user.html>), executing ALTER
> USER .... IDENTIFIED WITH sets the existing password to expired.  I assume
> this is the issue at hand.

Thanks for testing.

It is. Trying plan D now. My guess is that at some point, it will be necessary
to get the SQL version to adjust for syntax. That's another story.

I'll push this later (works with MariaDB 10.3 and MySQL 5.7 and 8.0):

diff --git a/deb/debian/mythtv-database.postinst b/deb/debian/mythtv-database.postinst
index e04ebc5..fbb6ebc 100644
--- a/deb/debian/mythtv-database.postinst
+++ b/deb/debian/mythtv-database.postinst
@@ -37,8 +37,8 @@ ask_root_pw() {

  update_database() {
      #Set up privs for mythtv at network
-    if ! echo "CREATE USER IF NOT EXISTS '$mythtv_username'@'%' IDENTIFIED BY '$mythtv_password'; \
-               ALTER USER '$mythtv_username'@'%' IDENTIFIED WITH mysql_native_password; \
+    if ! echo "CREATE USER IF NOT EXISTS '$mythtv_username'@'%' IDENTIFIED WITH mysql_native_password; \
+               ALTER USER '$mythtv_username'@'%' IDENTIFIED BY '$mythtv_password'; \
                 GRANT ALL ON $database.* TO '$mythtv_username'@'%';" | \
          mysql $SECURITY_INFO "$database" >/dev/null 2>&1; then


More information about the mythtv-users mailing list