CentOS 6.x version upgrade MySQL

Source: Internet
Author: User
Tags iptables

#-----------------------------CentOS 6.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/6/i386/epel-release-6-8.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
RPM-UVH remi-release-6*.rpm epel-release-6*.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/6/x86_64/epel-release-6-8.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
RPM-UVH remi-release-6*.rpm epel-release-6*.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-server--skip-broken-y
#7. Modifying configuration information for MySQL
Sed-i ' 3a Default-character-set = UTF8 '/etc/my.cnf
#8. Open firewall 3306 Port

Iptables-i input-m State--state new-m tcp-p TCP--dport 3306-j ACCEPT
Service Iptables Save


#9. Restart MySQL
Chkconfig--add mysqld
Service mysqld Restart

CentOS 6.x version upgrade MySQL

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.