首页 > 代码库 > 一键编译安装mysql-5.6.17
一键编译安装mysql-5.6.17
简单编译mysql5.6.17
配置文件my.cnf 请自行配置
cat mysql.sh
mkdir -p /opt/app
cd /opt/app
#创建文件存放目录
wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.17.tar.gz
tar -xf mysql-5.6.17.tar.gz
yum install -y make gcc-c++ cmake bison-devel ncurses-devel
#下载软件包并解压同时安装依赖库
groupadd mysql
useradd -g mysql mysql
#添加用户、组
cd /opt/app/mysql-5.6.17.tar.gz
#进入目录并配置
cmake -DCMAKE_INSTALl_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/opt/mysql/data -DSYSCONFDIR=/usr/local/mysql/etc -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DMYSQL_TCP_PORT=3306 -DENABLED_LOCAL_INFILE=1 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DENABLE_DOWNLOADS=1
make && make install
#编译完成
mkdir /usr/local/mysql/logs
#创建日志存放目录
chown -R mysql.mysql /usr/local/mysql/
#更改属组、主
cd /usr/local/mysql/scripts/
#初始化数据库
./mysql_install_db --defaults-file=/etc/my.cnf --basedir=/usr/local/mysql/ --datadir=/opt/mysql/data/ --user=mysql
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld
service mysqld restart
#启动mysql
echo MYSQL_HOME=/usr/local/mysql >> /etc/profile
echo export PATH=${MYSQL_HOME}/bin:$PATH >> /etc/profile
source /etc/profile
#完成!!!
本文出自 “蜗牛的嘲讽” 博客,请务必保留此出处http://imork.blog.51cto.com/11642843/1872705
一键编译安装mysql-5.6.17