mysql8.0编译安装
时间: 2023-10-27 16:08:24 浏览: 205
好的,关于mysql8.0的编译安装,可以按照以下步骤进行:
1. 下载mysql源码包,解压到指定目录
2. 安装必要的依赖库,如cmake、gcc等
3. 进入解压后的mysql源码目录,执行以下命令:
```
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_DATADIR=/usr/local/mysql/data \
-DSYSCONFDIR=/etc \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_MEMORY_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DMYSQL_UNIX_ADDR=/var/run/mysql/mysql.sock \
-DMYSQL_TCP_PORT=3306 \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DEXTRA_CHARSETS=all \
-DDEFAULT_CHARSET=utf8mb4 \
-DDEFAULT_COLLATION=utf8mb4_general_ci
make && make install
```
4. 执行以下命令添加mysql用户和组,并设置权限:
```
groupadd mysql
useradd -r -g mysql mysql
cd /usr/local/mysql
chown -R mysql:mysql .
bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
chown -R root .
chown -R mysql:mysql data
bin/mysqld_safe --user=mysql &
cp support-files/mysql.server /etc/init.d/mysql.server
chmod +x /etc/init.d/mysql.server
chkconfig --add mysql.server
```
5. 启动mysql服务:
```
service mysql.server start
```
阅读全文