首先安装依赖包,避免在安装过程中出现问题
[[email protected] liuzhen]# yum -y install gcc gcc-c++ [[email protected] liuzhen]# yum -y install cmake [[email protected] liuzhen]# yum -y install ncurses-devel
mysql源码下载地址:https://dev.mysql.com/downloads/mysql/5.6.html#downloads
源码包地址:https://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.35.tar.gz
创建mysql安装目录以及数据存放目录
[[email protected] liuzhen]# mkdir /usr/local/mysql [[email protected] liuzhen]# mkdir /usr/local/mysql/data
创建用户、用户组
[[email protected] liuzhen]# groupadd mysql [[email protected] liuzhen]# useradd -r -g mysql mysql
开始安装
[[email protected] liuzhen]# tar -zxvf mysql-5.6.35.tar.gz [[email protected] liuzhen]# cd mysql-5.6.35 [[email protected] mysql-5.6.35]# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DINSTALL_DATADIR=/usr/local/mysql/data -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DEXTRA_CHARSETS=all -DENABLED_LOCAL_INFILE=1 [[email protected] mysql-5.6.35]# make && make install
CMAKE参数说明:
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql //默认安装目录
-DINSTALL_DATADIR=/usr/local/mysql/data //数据库存放目录
-DDEFAULT_CHARSET=utf8 //使用utf8字符
-DDEFAULT_COLLATION=utf8_general_ci //校验字符
-DEXTRA_CHARSETS=all //安装所有扩展字符集
-DENABLED_LOCAL_INFILE=1 //允许从本地导入数据
-DMYSQL_USER=mysql
-DMYSQL_TCP_PORT=3306
时间: 2024-10-10 04:01:51