xtrabackup 升级 mysql_使用percona-xtrabackup-2.0.8将MySQL从5.1.73升级到5.6.36-阿里云开发者社区...
1、安装xtrabackupcd /usr/local/tar xvf percona-xtrabackup-2.0.8-587.tar.gzmv percona-xtrabackup-2.0.8 xtrabackupvim /root/.bash_profilePATH=$PATH:$HOME/bin:/usr/local/xtrabackup/binsource /root/.bash_pro
1、安装xtrabackup
cd /usr/local/
tar xvf percona-xtrabackup-2.0.8-587.tar.gz
mv percona-xtrabackup-2.0.8 xtrabackup
vim /root/.bash_profile
PATH=$PATH:$HOME/bin:/usr/local/xtrabackup/bin
source /root/.bash_profile
2、全量备份mysql 5.1.73数据库
innobackupex --user=root --password=****** --socket=/var/lib/mysql/mysql.sock /root
3、安装 mysql 5.6.36
yum install -y autoconf automake imake libxml2-devel expat-devel cmake gcc gcc-c++ libaio libaio-devel bzr bison libtool ncurses5-devel
groupadd -r mysql
useradd -r -g mysql mysql
tar zxf mysql-5.6.26-linux-glibc2.5-x86_64.tar.gz -C /usr/local/
cd /usr/local/
ln -s mysql-5.6.26-linux-glibc2.5-x86_64/ mysql
mkdir /mysqldata
chown -R mysql.mysql /mysqldata/
cd mysql
chown -R root.mysql ./*
scripts/mysql_install_db --user=mysql --datadir=/usr/local/mysql/data
cp support-files/mysql.server /etc/init.d/mysqld
chkconfig --add mysqld
vim /etc/profile.d/mysql.sh
export PATH=$PATH:/usr/local/mysql/bin
. /etc/profile.d/mysql.sh
service mysqld start
vim my.cnf
datadir = /mysqldata
socket = /tmp/mysql.sock
service mysqld start
mysql_secure_installation
mysql -u root -p
4、使用xtrabackup还原数据库
service mysqld start
mv /usr/local/mysql/data/* /tmp
innobackupex --socket=/tmp/mysql.sock --apply-log /root/2017-07-04_10-41-46
innobackupex --socket=/tmp/mysql.sock --defaults-file=/usr/local/mysql/my.cnf --copy-back /root/2017-07-04_10-41-46
chown -R mysql.mysql /usr/local/mysql/data
service mysqld restart
5、更新数据库
mysql_upgrade -u root -p
本文转自1321385590 51CTO博客,原文链接:http://blog.51cto.com/linux10000/1944483,如需转载请自行联系原作者
开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!
更多推荐
所有评论(0)