Mysql源码编译安装

系统运维 waitig 483℃ 百度已收录 0评论

安装环境:centos 6.8    mysql-5.6.36

1.安装mysql的依赖包

yum install ncurses ncurses-devel cmake git -y

2.创建mysql用户

useradd mysql

mkdir -p /usr/local/mysql

chown -R mysql:mysql /usr/local/mysql

3.安装mysql(5.6.36)

wget -c -P /src http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.36.tar.gz

tar zxvf /src/mysql-5.6.36.tar.gz -C /src

cd /src/mysql-5.6.36

cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \

-DMYSQL_DATADIR=/data/mysql \

-DSYSCONFDIR=/etc \

-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \

-DMYSQL_USER=mysql \

-DMYSQL_TCP_PORT=3306 \

-DWGE_ENGINE=1 \

-DWITH_INNOBASE_STORAGE_ENGINE=1 \

-DWITH_PARTITION_STORAGE_ENGINE=1 \

-DWITH_BLACGINE=1 \

-DWITH_MYISAM_STORAGE_ENGINE=1 \

-DWITH_READLINE=1 \

-DENABLED_LOCAL_INFILE=1 \

-DWITH_EXDDEFAULT_CHARSET=utf8 \

-DDEFAULT_COLLATION=utf8_general_ci \

-DEXTRA_CHARSETS=all \

-DWITH_BIG_DEBUG=0

make&&make install

4.配置mysql

mkdir -p /data/mysql

chown -R mysql:mysql /data

cat > /etc/my.cnf << EOF

[mysqld]

datadir =/data/mysql

socket =/tmp/mysql.sock

user = mysql

log-error =/var/log/mysqld.log

character_set_server= utf8

        

[client]

default-character-set= utf8

        

[mysql]

default-character-set= utf8

EOF

 

/usr/local/mysql/scripts/mysql_install_db –user=mysql–datadir=/data/mysql –basedir=/usr/local/mysql

cp /usr/local/mysql/support-files/mysql.server/etc/init.d/mysqld

chmod +x /etc/init.d/mysqld

ln -s /usr/local/mysql/bin/* /usr/bin

5.将mysql服务设置为开机启动

chkconfig –add mysqld

chkconfig –level 35 mysqld on

servicemysqld start


本文由【waitig】发表在等英博客
本文固定链接:Mysql源码编译安装
欢迎关注本站官方公众号,每日都有干货分享!
等英博客官方公众号
点赞 (0)分享 (0)