在Linux系統(tǒng)中安裝MySQL80,需要進行以下步驟:
1. 下載MySQL80安裝包
wget https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.26-linux-glibc2.12-x86_64.tar.xz
2. 解壓安裝包
tar -xvf mysql-8.0.26-linux-glibc2.12-x86_64.tar.xz mv mysql-8.0.26-linux-glibc2.12-x86_64 /usr/local/mysql
3. 創(chuàng)建MySQL服務賬戶和組
groupadd mysql useradd -r -g mysql -s /bin/false mysql
4. 修改MySQL默認配置文件
cd /usr/local/mysql cp support-files/my-default.cnf /etc/my.cnf sed -i 's/^# basedir = ....$/basedir = \/usr\/local\/mysql/' /etc/my.cnf sed -i 's/^# datadir = ....$/datadir = \/usr\/local\/mysql\/data/' /etc/my.cnf sed -i 's/^# port = ....$/port = 3306/' /etc/my.cnf
5. 初始化MySQL
./bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
6. 啟動MySQL
./bin/mysqld_safe --user=mysql &
7. 設置MySQL密碼
./bin/mysql_secure_installation
8. 配置MySQL服務
cp support-files/mysql.server /etc/init.d/mysqld chmod +x /etc/init.d/mysqld chkconfig --add mysqld chkconfig mysqld on
至此,MySQL80在Linux系統(tǒng)中的安裝已經(jīng)完成。