MariaDB Install on Debian 12 在 Debian 12 上安裝 MariaDB


Install MariaDB Server

sudo apt update && sudo apt upgrade -y
sudo apt install mariadb-server -y

Start MariaDB and Enable it to Launch on Startup

sudo systemctl start mariadb
sudo systemctl enable mariadb

Security Settings

sudo mysql_secure_installation

Create Super Admin Account

Login to the MySQL server.

mysql -u ACCOUNT -p
CREATE USER 'admin'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON *.* TO 'admin'@'localhost' WITH GRANT OPTION;
FLUSH PRIVILEGES;

安裝 MariaDB 伺服器

sudo apt update && sudo apt upgrade -y
sudo apt install mariadb-server -y

啟動 MariaDB 並設定開機自動啟動

sudo systemctl start mariadb
sudo systemctl enable mariadb

安全性設定

sudo mysql_secure_installation

建立超級管理員帳號

登入 MySQL 伺服器。

mysql -u ACCOUNT -p
CREATE USER 'admin'@'localhost' IDENTIFIED BY '你的密碼';
GRANT ALL PRIVILEGES ON *.* TO 'admin'@'localhost' WITH GRANT OPTION;
FLUSH PRIVILEGES;