How to Install MySQL 9.7 LTS on Debian 13
Install MySQL 9.7 LTS on Debian 13 (Trixie), confirm APT is using Oracle’s repository, and verify the server and connection.
On this page
Debian 13 (Trixie) can install MySQL 9.7 LTS from Oracle’s MySQL APT repository. This guide configures the LTS series, checks that APT sees the Debian 13 packages, and verifies the server after installation. Debian’s release information lists the current Debian release.
These steps assume a fresh MySQL installation. If the system already contains MySQL or MariaDB data, make and verify a backup before changing package sources. Oracle’s replacement instructions cover Debian or Ubuntu’s native MySQL packages; they do not support replacing MariaDB in place, so plan a separate migration. While Oracle’s repository is enabled, APT uses it for MySQL packages, and a system-wide upgrade can replace native MySQL packages with Oracle’s versions.
Prerequisites
Before you begin, make sure you have:
- Debian 13 with internet access.
- A user account with
sudoprivileges. - A fresh installation, or a verified backup of any database you intend to replace.
Add the MySQL APT Repository
Confirm that the system identifies its Debian codename as trixie:
grep -E '^(PRETTY_NAME|VERSION_CODENAME)=' /etc/os-release
Download and install Oracle’s MySQL APT repository configuration package. As of September 2026, the package is version 0.8.40-1; check the download page for the current filename if it has changed:
sudo apt update
sudo apt install -y wget
wget https://dev.mysql.com/get/mysql-apt-config_0.8.40-1_all.deb
sudo dpkg -i mysql-apt-config_0.8.40-1_all.deb
In the configuration dialog, select MySQL Server & Cluster, choose mysql-9.7-lts, and finish the configuration. Then refresh APT’s package information:
sudo apt update
Check the candidate package before installing:
apt-cache policy mysql-server
The candidate should be from Oracle’s repository and use the MySQL 9.7 series. The exact package version changes as Oracle publishes maintenance updates. The live Debian Trixie MySQL 9.7 package index currently lists the server package for this release.
If APT does not show a 9.7 candidate, reopen the repository configuration, select the 9.7 LTS series, and refresh the package list:
sudo dpkg-reconfigure mysql-apt-config
sudo apt update
Install MySQL Server
Install the server and its required client packages:
sudo apt install mysql-server
During installation, set a password for the MySQL root account. If you leave the password blank, local root connections use socket authentication; see the MySQL APT installation notes.
Verify MySQL and Connect
Check the client version and service status:
mysql --version
sudo systemctl status mysql --no-pager
If you set a password during installation, connect as root with:
sudo mysql -u root -p
If you left the password blank and kept socket authentication, connect with sudo mysql. At the MySQL prompt, verify the server version:
SELECT VERSION();
Exit with exit;.
Manage the MySQL Service
The APT packages start MySQL after installation and enable it at boot. Use systemctl to manage the service:
sudo systemctl start mysql
sudo systemctl stop mysql
sudo systemctl restart mysql
sudo systemctl status mysql --no-pager
Conclusion
You installed MySQL 9.7 LTS on Debian 13 and checked that APT selected Oracle’s 9.7 repository. For MySQL 9.7 LTS on Ubuntu 26.04, see our Ubuntu 26.04 installation guide. For more database material, visit our MySQL tutorials and MySQL Reference.