Skip to content

Commit

Permalink
debian: choose mysql_native_password
Browse files Browse the repository at this point in the history
In mysql version 8.x (*buntu 20.04), mythweb fails because
the PHP mysqli connector doesn't support the new default
caching_sha2_authentication. Existing DB users work OK,
but newly created ones won't.

Somewhat ugly solution as MySQL 5.x/8.x and MariaDB CREATE USER
syntax is slightly different. Use ALTER USER after creation.

See: https://mysqlserverteam.com/upgrading-to-mysql-8-0-default-authentication-plugin-considerations/
     https://mariadb.com/kb/en/create-user/#identified-viawith-authentication_plugin

Tested on MariaDB 10.3 and mysql 5.7 and 8.0.

Refs #13576
  • Loading branch information
Bill Meek committed Feb 10, 2020
1 parent 46abf78 commit 5c632ca
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions deb/debian/mythtv-database.postinst
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ ask_root_pw() {

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

0 comments on commit 5c632ca

Please sign in to comment.