编译安装MySQL5.6.26脚本

#!/bin/bash

mysql_install_dir=/usr/local/mysql

mysql_data_dir=/data/mysql

mysql_6_version=5.6.26

dbrootpwd=root

Mem=`free -m | awk ‘/Mem:/{print $2}‘`

Swap=`free -m | awk ‘/Swap:/{print $2}‘`

Install_MySQL-5-6()

{

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

wget http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-${mysql_6_version}.tar.gz

id -u mysql >/dev/null 2>&1

[ $? -ne 0 ] && useradd -M -s /sbin/nologin mysql

mkdir -p $mysql_data_dir;chown mysql.mysql -R $mysql_data_dir

tar zxf mysql-${mysql_6_version}.tar.gz

cd mysql-$mysql_6_version

make clean

[ ! -d "$mysql_install_dir" ] && mkdir -p $mysql_install_dir

cmake . -DCMAKE_INSTALL_PREFIX=$mysql_install_dir \

-DMYSQL_DATADIR=$mysql_data_dir \

-DSYSCONFDIR=/etc \

-DWITH_INNOBASE_STORAGE_ENGINE=1 \

-DWITH_PARTITION_STORAGE_ENGINE=1 \

-DWITH_FEDERATED_STORAGE_ENGINE=1 \

-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \

-DWITH_MYISAM_STORAGE_ENGINE=1 \

-DWITH_INNOBASE_STORAGE_ENGINE=1 \

-DENABLED_LOCAL_INFILE=1 \

-DENABLE_DTRACE=0 \

-DEXTRA_CHARSETS=all \

-DDEFAULT_CHARSET=utf8mb4 \

-DDEFAULT_COLLATION=utf8mb4_general_ci \

-DWITH_EMBEDDED_SERVER=1 \

make -j `grep processor /proc/cpuinfo | wc -l`

make install

if [ -d "$mysql_install_dir/support-files" ];then

    echo "${CSUCCESS}MySQL install successfully! ${CEND}"

    cd ..

    rm -rf mysql-$mysql_6_version

else

    rm -rf $mysql_install_dir

    echo "${CFAILURE}MySQL install failed, Please contact the author! ${CEND}"

    kill -9 $$

fi

/bin/cp $mysql_install_dir/support-files/mysql.server /etc/init.d/mysqld

chmod +x /etc/init.d/mysqld

chkconfig mysqld on

cd ..

[ -d "/etc/mysql" ] && /bin/mv /etc/mysql{,_bk}

$mysql_install_dir/scripts/mysql_install_db --user=mysql --basedir=$mysql_install_dir --datadir=$mysql_data_dir

chown mysql.mysql -R $mysql_data_dir

service mysqld start

[ -z "`grep ^‘export PATH=‘ /etc/profile`" ] && echo "export PATH=$mysql_install_dir/bin:\$PATH" >> /etc/profile

[ -n "`grep ^‘export PATH=‘ /etc/profile`" -a -z "`grep $mysql_install_dir /etc/profile`" ] && sed -i "[email protected]^export PATH=\(.*\)@export PATH=$mysql_install_dir/bin:\[email protected]" /etc/profile

. /etc/profile

$mysql_install_dir/bin/mysql -e "grant all privileges on *.* to [email protected]‘127.0.0.1‘ identified by \"$dbrootpwd\" with grant option;"

$mysql_install_dir/bin/mysql -e "grant all privileges on *.* to [email protected]‘localhost‘ identified by \"$dbrootpwd\" with grant option;"

$mysql_install_dir/bin/mysql -uroot -p$dbrootpwd -e "delete from mysql.user where Password=‘‘;"

$mysql_install_dir/bin/mysql -uroot -p$dbrootpwd -e "delete from mysql.db where User=‘‘;"

$mysql_install_dir/bin/mysql -uroot -p$dbrootpwd -e "delete from mysql.proxies_priv where Host!=‘localhost‘;"

$mysql_install_dir/bin/mysql -uroot -p$dbrootpwd -e "drop database test;"

$mysql_install_dir/bin/mysql -uroot -p$dbrootpwd -e "reset master;"

rm -rf /etc/ld.so.conf.d/{mysql,mariadb,percona}*.conf

echo "$mysql_install_dir/lib" > mysql.conf

/sbin/ldconfig

service mysqld stop

}

Install_MySQL-5-6

时间: 2024-10-13 11:45:59

编译安装MySQL5.6.26脚本的相关文章

Ubuntu15.04下源码安装MySQL5.6.26数据库

解决Ubuntu 15.04版下源码编译安装MySQL5.6.26数据库问题,这里提供依赖包下载,源码安装方法. (1)安装编译源码需要的包 sudoapt-get install make cmake gcc g++ bison libncurses5-dev 依赖包在博客附件里有下载.下面也有说明一些解决方法. 另外的:cmake-2.8.3.tar.gz安装啊.bison_3.0.2.dfsg-2_i386.deb.ncurses-5.9.tar.gz的依赖缺少的话自己可以去下载安装,由于

开发人员学Linux(6):CentOS7编译安装MySQL5.17.8多实例及主从复制

1.前言上一篇讲述了如何在CentOS7下编译安装Nginx-1.12.0并如何配置反向代理,本篇将讲述如何编译安装MySQL5.7.18并配置多实例.2.准备2.1下载MySQL5.7.18源码注意最新版本的MySQL需要Boost才能编译安装,在MySQL提供的下载中有不带boost的源码,还有带boost的源码,如果下载不带boost的源码还需要再去下载boost源码,为省事起见,建议下载带boost的源码,下载地址:https://cdn.mysql.com//Downloads/MyS

cmake编译安装mysql5.5

CMAKE方式编译安装Mysql5.5 1.源码cmake方式编译安装MySQL5.5.32 安装前先安装: yum install ncurses-devel -y 1.1 下载Mysql和cmake安装包: wget http://wwwNaNake.org/files/v2.8/cmake-2.8.8.tar.gz 1.2 查看系统环境 cat /etc/redhat-release uname -r uname -m 1.3 安装cmake包 tar zxf cmake-2.8.8.ta

一、Ubuntu下编译安装Mysql5.0.45

一.编译安装Mysql5.0.45 在Ubuntu下搭建LNMP环境.编译安装mysql,nginx,php.最后在LNMP前提下安装composer,并且安装laravel框架.首先,第一步开始编译安装Mysql. 步骤: cd /usr/local/src,进入到文件夹中,这个文件夹用来保存所需使用的软件安装包. 接着键入"sudo wgethttp://downloads.mysql.com/archives/mysql-5.0/mysql-5.0.45.tar.gz"回车,如果

CentOS6.7下使用cmake编译安装MySQL5.5.32笔记

一.安装cmake编译环境1.1 使用yum方式安装gcc [[email protected] ~]# yum install gcc 1.2 使用yum方式安装gcc-c++ [[email protected] ~]# yum install gcc-c++ 1.3 解压camke源文件 将cmake源文件放入/tmp/文件夹下 1 [[email protected] ~]# cd /tmp 2 [[email protected] ~]# tar -xf cmake-2.8.8.tar

三、编译安装mysql-5.5.33

三.编译安装mysql-5.5.33 1.准备数据存放的文件系统: 新建一个逻辑卷(过程见链接),并将其挂载至/mydata/data目录, 做为mysql数据的存放目录. http://858004880.blog.51cto.com/7265424/1759317 2.新建用户以安全方式运行进程: 1.删除系统原来的mysql用户家目录 [[email protected] ~]# userdel -r mysql 2.创建mysql系统用户组 [[email protected] ~]# 

CentOS6.5_64bit下编译安装MySQL-5.6.23

转载请注明出处:http://blog.csdn.net/guoyjoe/article/details/44785511 ************************************************************         CentOS6.5_64bit下编译安装MySQL-5.6.23 **************************************************************一.关闭防火墙chkconfig iptable

centos6.4下编译安装MySQL-5.5.33

若想在6.4版本下的centos编译安装MySQL必须使用新的编译器cmake. 1)安装cmake 直接yum安装 2)编译安装参数 使用cmake编译安装mysql-5.5.33,选项的方式有所改变: ./configure                cmake .            编译   ./configure –help         cmake . -LH or ccmake .   获取帮助 指定安装文件的安装路径时常用的选项:    -DCMAKE_INSTALL_P

CMAKE方式编译安装Mysql5.5

1.源码cmake方式编译安装MySQL5.5.32 安装前先安装: yum install ncurses-devel -y 1.1 下载Mysql和cmake安装包: wgethttp://wwwNaNake.org/files/v2.8/cmake-2.8.8.tar.gz 1.2 查看系统环境 cat/etc/redhat-release uname-r uname-m 1.3 安装cmake包 tarzxf cmake-2.8.8.tar.gz cdcmake-2.8.8 ./conf