码迷,mamicode.com
首页 > 数据库 > 详细

CentOS 7源码编译mysql-5.6.37

时间:2018-03-21 00:00:29      阅读:216      评论:0      收藏:0      [点我收藏+]

标签:。/;’

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

标签:。/;’

原文地址:http://blog.51cto.com/13132636/2089200

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!