mysql5.6源码包_源码包编译安装MySQL 5.6脚本

#!/bin/bash

groupadd mysql

useradd -g mysql -s /sbin/nologin mysql

mkdir -p /data/3306

chown -R mysql.mysql /data/3306

chmod 755 /data/3306

#mount -o loop /tmp/rhel6.iso /mnt/

yum -y install make gcc-c++ cmake bison-devel ncurses-devel openssl openssl-devel bison

tar -zxvf /tmp/mysql-5.6.16.tar.gz -C /usr/local/src/

mv /usr/local/src/mysql-5.6.16/ /usr/local/src/mysql-master

read -n1 var

cd /usr/local/src/mysql-master

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

-DMYSQL_DATADIR=/data/3306/data \

-DMYSQL_TCP_PORT=3306 \

-DMYSQL_UNIX_ADDR=/var/run/mysqld/mysql-master.sock \

-DSYSCONFDIR=/usr/local/mysql-master \

-DDEFAULT_CHARSET=gbk \

-DDEFAULT_COLLATION=gbk_chinese_ci \

-DWITH_EXTRA_CHARSETS=ALL \

-DMYSQL_USER=mysql

read -n1 var

make

read -n1 var

make install

read -n1 var

chown -R mysql.mysql /usr/local/mysql-master

/usr/local/mysql-master/scripts/mysql_install_db --basedir=/usr/local/mysql-master --datadir=/data/3306/data --user=mysql

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

read -n1 var

chmod +x /etc/init.d/mysqld-master

chkconfig --add mysqld-master

chkconfig mysqld-master on

/etc/init.d/mysqld-master start

mysql-5.6.25.tar 含两个文件: - mysql-5.6.25.tar.gz Generic Linux (Architecture Independent), Compressed TAR Archive MD5: 37664399c91021abe070faa700ecd0ed -install.txt: 安装方法 首先解压mysql-5.6.25.tar: $ tar xf mysql-5.6.25.tar ------------------ Mysql 源码安装操作: 1. 创建用户 # groupadd mysql # useradd -g -r mysql mysql 2. 解压缩tar # tar xf mysql-5.6.25.tar.gz # cd mysql-5.6.25 3. 编译安装 # cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \ > -DDEFAULT_CHARSET=gbk \ > -DDEFAULT_COLLATION=gbk_chinese_ci \ > -DENABLED_LOCAL_INFILE=ON \ > -DWITH_INNOBASE_STORAGE_ENGINE=1 \ > -DWITH_FEDERATED_STORAGE_ENGINE=1 \ > -DWITH_BLACKHOLE_STORAGE_ENGINE=1 \ > -DMYSQL_UNIX_ADDR=/tmp/mysqld.sock \ > -DWITH_DEBUG=0 \ > -DMYSQL_TCP_PORT=3306 # make # make install 4. 配置以及初始化MySQL # cd /usr/local/mysql 4.1 设置MySQL安装目录的权限 # chown -R mysql:mysql /usr/local/mysql 4.2 初始化MySQL # scripts/mysql_install_db --user=mysql # cp support-files/mysql.server /etc/init.d/mysqld 4.3 重新设置MySQL安装目录的权限(除data目录外,其余所有目录及文件均修改用户为root,组不变) # chown -R root . # chown -R mysql data 4.4 启动mysql_safe # bin/mysqld_safe --user=mysql & 4.5 设置MySQL的root帐号密码 - 自动设置:# ./bin/mysql_secure_installation 或 - 手动置:# ./bin/mysqladmin -u root password '' ------------------ 操作详情参看: https://github.com/Marslo/MyBlog/blob/master/Programming/MySQL/MySQLInstallationBySourceCode.md MySQL6源码安装官方手册: http://dev.mysql.com/doc/refman/5.6/en/installing-source-distribution.html ------------------ 资源为英文,下载请谨慎
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值