大纲
前言
本文将介绍 Debian 12 如何基于 APT 包管理器在线安装 MySQL 8.4(LTS 版本)。
版本历史
LTS 版本
MySQL 8.4 是一个长期支持(LTS)版本,它的主流支持将持续到 2029 年 4 月 30 日,而延长支持将持续到 2032 年 4 月 30 日。这意味着 MySQL 8.4 将享有总计 8 年的支持周期,其中前 5 年为完全支持,后 3 年为延长支持。
准备工作
更换软件源
1 2
| sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| sudo cat > /etc/apt/sources.list << EOF deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bookworm-security main contrib non-free non-free-firmware deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security bookworm-security main contrib non-free non-free-firmware
deb https://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware deb-src https://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware EOF
|
安装常用工具
1
| sudo apt install -y vim curl tree net-tools
|
MySQL 安装
下载存储库工具
MySQL Server 8 在默认的 Debian 存储库中不可用,MySQL 团队提供了一个可下载的存储库工具包,该工具将为 MySQL Server 8 安装并配置存储库。
1 2
| wget https://repo.mysql.com//mysql-apt-config_0.8.32-1_all.deb
|
安装存储库工具
1 2 3 4 5
| sudo apt install -y gnupg
sudo dpkg -i mysql-apt-config_0.8.32-1_all.deb
|
安装 MySQL
1 2
| sudo apt install -y mysql-server
|
启动 MySQL
1 2 3 4 5 6 7 8 9 10 11
| sudo systemctl enable mysql
sudo systemctl status mysql
sudo systemctl start mysql
sudo systemctl start mysql
|
验证 MySQL
1
| sudo systemctl status mysql
|
1
| sudo tail -f -n 100 /var/log/mysql/mysqld.log
|
参考资料