How to install MySQL 8.4 LTS on Debian 12?

Tried to comment warning that triggers old warning message in installation script for Debian "Mysql 8 does not support Bookworm yet for Debian Unable to continue", which is not true, but that did not help in the end.

During installation your get next message and it stops the installation.

Updating currently installed packages, please wait... W: GPG error: http://repo.mysql.com/apt/debian bookworm InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY B7B3B788A8D3785C
E: The repository 'http://repo.mysql.com/apt/debian bookworm InRelease' is not signed.
\
The installer is now downloading and installing all required packages.
NOTE: This process may take 10 to 15 minutes to complete, please wait... 
E: Package 'mysql-client' has no installation candidate
E: Package 'mysql-server' has no installation candidate

Can someone help that needs to be modified in installation script to be able to install latest stable MySQL version 8.4? I had similar issues with MariaDB in another thread and you guys saved me.

I suspect that next part needs to be modified in installation script for Debian, but I am not entirely sure what to replace:

# Installing Mysql8 repo
if [ "$mysql8" = 'yes' ]; then
	echo "[ * ] Mysql 8"
	echo "deb [arch=$ARCH signed-by=/usr/share/keyrings/mysql-keyring.gpg] http://repo.mysql.com/apt/debian/ $codename mysql-apt-config" >> /etc/apt/sources.list.d/mysql.list
	echo "deb [arch=$ARCH signed-by=/usr/share/keyrings/mysql-keyring.gpg] http://repo.mysql.com/apt/debian/ $codename mysql-8.0" >> /etc/apt/sources.list.d/mysql.list
	echo "deb [arch=$ARCH signed-by=/usr/share/keyrings/mysql-keyring.gpg] http://repo.mysql.com/apt/debian/ $codename mysql-tools" >> /etc/apt/sources.list.d/mysql.list
	echo "#deb [arch=$ARCH signed-by=/usr/share/keyrings/mysql-keyring.gpg] http://repo.mysql.com/apt/debian/ $codename mysql-tools-preview" >> /etc/apt/sources.list.d/mysql.list
	echo "deb-src [arch=$ARCH signed-by=/usr/share/keyrings/mysql-keyring.gpg] http://repo.mysql.com/apt/debian/ $codename mysql-8.0" >> /etc/apt/sources.list.d/mysql.list

	GNUPGHOME="$(mktemp -d)"
	export GNUPGHOME
	for keyserver in $(shuf -e ha.pool.sks-keyservers.net hkp://p80.pool.sks-keyservers.net:80 keyserver.ubuntu.com hkp://keyserver.ubuntu.com:80); do
		gpg --no-default-keyring --keyring /usr/share/keyrings/mysql-keyring.gpg --keyserver "${keyserver}" --recv-keys "467B942D3A79BD29" > /dev/null 2>&1 && break
	done
fi

Replace this:

gpg --no-default-keyring --keyring /usr/share/keyrings/mysql-keyring.gpg --keyserver "${keyserver}" --recv-keys "467B942D3A79BD29" > /dev/null 2>&1 && break

by this:

gpg --no-default-keyring --keyring /usr/share/keyrings/mysql-keyring.gpg --keyserver "${keyserver}" --recv-keys "B7B3B788A8D3785C" > /dev/null 2>&1 && break

And try again.

1 Like

Thanks for the quick answer, however this only worked (got mysql Ver 8.0.40 for Linux on x86_64 (MySQL Community Server - GPL) if I don’t modify MySQL version in the installation script. I simply replaced β€œMysql 8” with β€œMysql 8.4” in next lines:

echo "[ * ] Mysql 8.4"
echo "deb [arch=$ARCH signed-by=/usr/share/keyrings/mysql-keyring.gpg] http://repo.mysql.com/apt/debian/ $codename mysql-8.4" >> /etc/apt/sources.list.d/mysql.list
echo "deb-src [arch=$ARCH signed-by=/usr/share/keyrings/mysql-keyring.gpg] http://repo.mysql.com/apt/debian/ $codename mysql-8.4" >> /etc/apt/sources.list.d/mysql.list

Is there more lines I need to replace or the formatting of the version is incorrect? https://dev.mysql.com/downloads/repo/apt/

Do I need to add something like this in installation script?

#Dependencies
multiphp_v=(β€œ5.6” β€œ7.0” β€œ7.1” β€œ7.2” β€œ7.3” β€œ7.4” β€œ8.0” β€œ8.1” β€œ8.2” β€œ8.3”)
fpm_v=β€œ8.2”
mariadb_v=β€œ10.11”
mysql_v=β€œ8.4”

Sorry, I don’t use MySQL so I thought 8.4 was the last version of 8.x but seems there are two branches.

The version is not the right one, checking the repo I see you should use mysql-8.4-lts instead of mysql-8.4

echo "[ * ] Mysql 8.4"
echo "deb [arch=$ARCH signed-by=/usr/share/keyrings/mysql-keyring.gpg] http://repo.mysql.com/apt/debian/ $codename mysql-8.4-lts" >> /etc/apt/sources.list.d/mysql.list
echo "deb-src [arch=$ARCH signed-by=/usr/share/keyrings/mysql-keyring.gpg] http://repo.mysql.com/apt/debian/ $codename mysql-8.4-lts" >> /etc/apt/sources.list.d/mysql.list

Remember to include the other echo "deb lines, the ones that don’t specify the version.

No, there is no need to add anything else.

1 Like

This worked. Thanks a lot!

Last quick question, how did you get/found correct recv-keys which is B7B3B788A8D3785C. Asking this, so I can avoid such questions in the future + might be useful for newbies like me.

And just note for other people who will try this, don’t forget to comment out next lines in installation script hst-instal-debian.sh:

#if [ "$mysql8" = 'yes' ] && [ "$release" = '12' ]; then
#       check_result 1 "Mysql 8 does not support Bookworm yet for Debian Unable to continue"
#fi
1 Like

You’re welcome :wink: And thank YOU to show the advise about the if block.

You have the key id B7B3B788A8D3785C in the error message.

Also, if you download the public key, you will see the key id:

mkdir /tmp/mysql-gpg/
cd /tmp/mysql-gpg/
wget http://repo.mysql.com/apt/debian/dists/bookworm/Release.gpg
gpg --list-packets Release.gpg

You will see the output that shows the key id:

# off=0 ctb=89 tag=2 hlen=3 plen=563
:signature packet: algo 1, keyid B7B3B788A8D3785C  <--- here
        version 4, created 1728970253, md5len 0, sigclass 0x00
        digest algo 8, begin of digest 50 9c
        hashed subpkt 33 len 21 (issuer fpr v4 BCA43417C3B485DD128EC6D4B7B3B788A8D3785C)
        hashed subpkt 2 len 4 (sig created 2024-10-15)
        subpkt 16 len 8 (issuer key ID B7B3B788A8D3785C) <--- here
        data: [4094 bits]
1 Like