debian10编译安装mysql5.7.35
时间: 2024-03-28 11:34:05 浏览: 183
编译安装MySQL 5.7.35在Debian 10上需要以下步骤:
1. 安装编译MySQL所需的依赖项:
```
sudo apt update
sudo apt install build-essential cmake libncurses5-dev libssl-dev libaio1
```
2. 下载MySQL 5.7.35源代码:
```
wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.35.tar.gz
tar -zxvf mysql-5.7.35.tar.gz
cd mysql-5.7.35
```
3. 配置和编译MySQL:
```
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/data -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DWITH_PERFSCHEMA_STORAGE_ENGINE=1 -DWITH_FEDERATED_STORAGE_ENGINE=1 -DWITH_SSL=yes
make
sudo make install
```
4. 创建MySQL用户和组:
```
sudo groupadd mysql
sudo useradd -r -g mysql -s /bin/false mysql
```
5. 初始化MySQL数据库:
```
sudo /usr/local/mysql/bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
```
6. 启动MySQL服务:
```
sudo cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
sudo chmod +x /etc/init.d/mysql
sudo service mysql start
```
现在,你已经成功编译安装了MySQL 5.7.35。你可以使用`mysql -V`命令来验证安装的版本。
阅读全文