centos7源码安装教程
时间: 2023-12-07 15:40:04 浏览: 124
Centos7虚拟机下——源码安装LAMP服务器
以下是CentOS7源码安装MySQL8.0的教程:
1. 下载MySQL源码包并解压
```shell
wget https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.25.tar.gz
tar -zxvf mysql-8.0.25.tar.gz
```
2. 安装必要的依赖
```shell
yum install -y cmake gcc gcc-c++ ncurses-devel openssl-devel bison
```
3. 创建MySQL用户和用户组
```shell
groupadd mysql
useradd -r -g mysql -s /bin/false mysql
```
4. 编译安装MySQL
```shell
cd mysql-8.0.25
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_DATADIR=/usr/local/mysql/data \
-DWITH_BOOST=boost \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_EMBEDDED_SERVER=1 \
-DWITH_SSL=system \
-DWITH_ZLIB=system \
-DWITH_LIBEVENT=system
make && make install
```
5. 配置MySQL
```shell
cd /usr/local/mysql
mkdir mysql-files
chmod 750 mysql-files
chown -R mysql .
chgrp -R mysql .
bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
cp support-files/mysql.server /etc/init.d/mysql.server
chkconfig --add mysql.server
chkconfig mysql.server on
```
6. 启动MySQL
```shell
service mysql.server start
```
7. 登录MySQL
```shell
mysql -uroot -p
```
阅读全文