CentOS 7源码编译mysql-5.6.37
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CentOS 7源码编译mysql-5.6.37相关的知识,希望对你有一定的参考价值。
1.1安装依赖
yum install ncurses-devel libaio-devel -y
rpm -qa ncurses-devel libaio-devel
1.2安装cmake
yum install cmake -y
rpm -qa cmake
1.3创建mysql用户
useradd -s /sbin/nologin -M mysql
id mysql
1.4下载/解压源码包
wget -q https://cdn.mysql.com//Downloads/MySQL-5.6/mysql-5.6.37.tar.gz
ls -l mysql-5.6.37.tar.gz
tar xf mysql-5.6.37.tar.gz
cd mysql-5.6.37
1.5编译安装
cmake . -DCMAKE_INSTALL_PREFIX=/application/mysql-5.6.37 \
-DMYSQL_DATADIR=/application/mysql-5.6.37/data \
-DMYSQL_UNIX_ADDR=/application/mysql-5.6.37/tmp/mysql.sock \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_EXTRA_CHARSETS=all \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_FEDERATED_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 \
-DWITH_ZLIB=bundled \
-DWITH_SSL=bundled \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_EMBEDDED_SERVER=1 \
-DENABLE_DOWNLOADS=1 \
-DWITH_DEBUG=0
make && make install
ln -s /application/mysql-5.6.37/ /application/mysql
1.6初始化及配置数据库
cd /application/mysql/
\cp -a support-files/my*.cnf /etc/my.cnf
chown -R mysql.mysql /application/mysql/
/application/mysql/scripts/mysql_install_db --basedir=/application/mysql --datadir=/application/mysql/data --user=mysql
mkdir tmp
chown -R root .
chown -R mysql data tmp
1.7设置开机自启动、并启动mysql
\cp support-files/mysql.server /etc/init.d/mysqld
chmod 700 /etc/init.d/mysqld
chkconfig mysqld on
systemctl start mysqld.service
ss -lntup|grep 330
1.8添加PATH路径
echo ‘PATH=/application/mysql/bin/:$PATH‘ >>/etc/profile
tail -1 /etc/profile
source /etc/profile
echo $PATH
mysql
以上是关于CentOS 7源码编译mysql-5.6.37的主要内容,如果未能解决你的问题,请参考以下文章
转的 CentOS 6.9上安装MySQL 5.6.37 (我用的centos7)