最新消息:走过的,离开的,已经错过,新开始2016

阿里云一键安装包 升级mysql5.5

技术随笔 果果 8473浏览 0评论

阿里云一键安装包,默认安装 mysql5.1  下面是 升级 mysql5.5的升级脚本

mysql 具体版本是mysql5.5.27 ,您可以修改 MYS_VER 版本 和相应的tar包下载路径,来选择其他版本

安装包下载

#!/bin/bash
# guoguo's blog #
# http://www.guoguo.it #
IN_DIR="/alidata/server"
MYS_VER="5.5.27"
if [ ! -f mysql-${MYS_VER}.tar.gz ];then
 wget -c http://dl.wdlinux.cn:5180/soft/mysql-${MYS_VER}.tar.gz
fi
yum install -y cmake gcc gcc-c++ gcc-g77 autoconf automake zlib* fiex* libxml* ncurses-devel libmcrypt* libtool-ltdl-devel* bison ncurses
tar zxvf mysql-${MYS_VER}.tar.gz
chmod -R 777 mysql-${MYS_VER}.tar.gz
cd mysql-${MYS_VER}
cmake -DCMAKE_INSTALL_PREFIX=$IN_DIR/mysql-$MYS_VER -DEXTRA_CHARSETS=all -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_SSL=no -DWITH_DEBUG=OFF -DWITH_EXTRA_CHARSETS=complex -DENABLED_PROFILING=ON -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1
[ $? != 0 ] && echo "configure err" && exit
make
[ $? != 0 ] && echo "make err" && exit
make install
[ $? != 0 ] && echo "make install err" && exit
service mysqld stop
if [ ! -d /alidata/server/mysql_bk ];then
mkdir -p /alidata/server/mysql_bk
cp -pR /alidata/server/mysql/var/* /alidata/server/mysql_bk
fi
rm -f /alidata/server/mysql
ln -sf $IN_DIR/mysql-$MYS_VER /alidata/server/mysql
mv /etc/my.cnf /etc/my.cnf.bak
cp support-files/my-medium.cnf /etc/my.cnf
sed '/skip-external-locking/i\datadir = /usr/local/mysql/var' -i /etc/my.cnf
#sh scripts/mysql_install_db.sh --user=mysql --basedir=/alidata/server/mysql --datadir=/alidata/server/mysql/var
/alidata/server/mysql/scripts/mysql_install_db --defaults-file=/etc/my.cnf --basedir=/alidata/server/mysql --datadir=/alidata/server/mysql/var --user=mysql
chown -R mysql.mysql /alidata/server/mysql/var
mv /alidata/server/mysql/var/mysql /alidata/server/mysql/var/mysqlo
cp -pR /alidata/server/mysql_bk/* /alidata/server/mysql/var/
mv /etc/init.d/mysqld /etc/init.d/mysqld.bak
cp support-files/mysql.server /etc/init.d/mysqld
chmod 755 /etc/init.d/mysqld
service mysqld restart
echo
if [ -d /alidata/server/mysql-5.1.57 ];then
 ln -sf /alidata/server/mysql-5.1.57/lib/mysql/libmysqlclient.so.16* /usr/lib/
fi
sleep 2
echo
echo "mysql update is OK"

php 5.4 升级脚本 http://www.guoguo.it/?p=685

如有问题可以留言,将不定期回答。

转载请注明:果果.IT » 阿里云一键安装包 升级mysql5.5

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址