#-----------------------------CentOS 5.x version upgrade MySQL------------------
#! /bin/sh
#1. Turn off SELinux
Cp-rp/etc/selinux/config/etc/selinux/config.bak
Setenforce 0
Sed-i ' 7s/enforcing/disabled/'/etc/selinux/config
#2. Show SELinux status permissive to Off
Getenforce
#3. Determine the version of the system
If ["$ (uname-i)" = i386]; Then
# If the server is 32-bit, run the following command
echo "Start downloading third-party Remi Library i386"
wget http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
RPM-UVH remi-release-5*.rpm epel-release-5*.rpm
Else
# # If it's 64-bit then run the following command
echo "Download third-party Remi Library X64"
wget http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
RPM-UVH remi-release-5*.rpm epel-release-5*.rpm
Fi
#4. Modify the Remi.repo configuration file if you want to upgrade to php5.4.x only, change the [Remi] section to 1
#如果想升级到php5.5.x, then change the [Remi] and [remi-php55] parts of enabled to 1
Cp-rp/etc/yum.repos.d/remi.repo/etc/yum.repos.d/remi.repo.bak
Sed-i ' 9s/enabled=0/enabled=1/'/etc/yum.repos.d/remi.repo
Sed-i ' 18s/enabled=0/enabled=1/'/etc/yum.repos.d/remi.repo
Sed-i ' 7s/^#//'/etc/yum.repos.d/remi.repo
Sed-i ' 8s/^/#&/'/etc/yum.repos.d/remi.repo
Sed-i ' 15s/^#//'/etc/yum.repos.d/remi.repo
Sed-i ' 16s/^/#&/'/etc/yum.repos.d/remi.repo
#修改下面epel. Repo profile Information Otherwise it will be an error.
Cp-rp/etc/yum.repos.d/epel.repo/etc/yum.repos.d/epel.repo.bak
Sed-i ' 3s/^#//'/etc/yum.repos.d/epel.repo
Sed-i ' 12s/^#//'/etc/yum.repos.d/epel.repo
Sed-i ' 21s/^#//'/etc/yum.repos.d/epel.repo
Sed-i ' 4s/^/#&/'/etc/yum.repos.d/epel.repo
Sed-i ' 13s/^/#&/'/etc/yum.repos.d/epel.repo
Sed-i ' 22s/^/#&/'/etc/yum.repos.d/epel.repo
#5. Check to see if the system is MySQL version before MySQL uninstall is installed
Yum list MySQL
Yum Remove MySQL mysql-server-y
#6. Install the latest MySQL
echo "Installing new version of MySQL please Wait"
Yum--enablerepo=remi install MySQL mysql-sercver--skip-broken-y
#7. Modifying configuration information for MySQL
Sed-i ' 3a Default-character-set = UTF8 '/etc/my.cnf
#8. Open firewall 3306 Port
Sed-i ' 10a-a input-m State--state new-m tcp-p TCP--dport 3306-j ACCEPT '/etc/sysconfig/iptables
#9. Restart MySQL
Chkconfig--add mysqld
Service mysqld Restart
CentOS 5.x Version upgrade MySQL