MySQL是一種開源的關系型數據庫管理系統,被廣泛應用于Web開發和企業級解決方案。本文將提供MySQL軟件安裝的詳細步驟和注意事項。
下載MySQL軟件包:
wget https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
安裝MySQL軟件:
sudo rpm -ivh mysql80-community-release-el7-3.noarch.rpm sudo yum install mysql-server
啟動MySQL:
sudo systemctl start mysqld
設置MySQL開機啟動:
sudo systemctl enable mysqld
檢查MySQL是否啟動:
sudo systemctl status mysqld
設置MySQL的初始密碼:
sudo grep 'temporary password' /var/log/mysqld.log mysql -uroot -p輸入密碼 ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';
設置MySQL的字符集:
sudo vi /etc/my.cnf [mysqld] character-set-server=utf8mb4 [client] default-character-set=utf8mb4
重啟MySQL:
sudo systemctl restart mysqld
通過MySQL客戶端登陸MySQL:
mysql -uroot -p