Centos Mysql Upgrade

Source: Internet
Author: User

How to upgrade the MySQL under CentOS 6.5

The CentOS 6.5 comes with MySQL 5.1 installed, but 5.1 has a lot of limitations, and in practice we've already used MySQL 5.6, which causes some scripts to execute in MySQL 5.1 with an error. We can only upgrade MySQL

Method/Step
  1. 1

    Backing up the database, upgrading MySQL usually does not lose data, but for the sake of insurance, we need to do this step. Enter the command:

    Mysqldump-u xxx-h xxx-p 3306-p--all-databases > Databases.sql

  2. 2

    To stop the MySQL service, enter the command:

    Service Mysqld Stop

  3. 3

    To uninstall the old version of MySQL, enter the command:

    Yum Remove MySQL mysql-*

    During execution, you will be asked if you want to remove, enter "Y" at this time

  4. 4

    After removing the command, you can see if there is any remaining MySQL, enter the command:

    Yum List Installed | grep MySQL

    If so, you can enter the command to delete:

    Rum Remove Mysql-libs

    Add: If the above method or uninstall is not clean, then refer to the following unloading method, generally can be uninstalled clean

    1. Yum-style installation of MySQL

    1. Yum remove MySQL mysql-server mysql-libs compat-mysql51

    2, Rm-rf/var/lib/mysql

    3, RM/ETC/MY.CNF

    See if you have MySQL software:
    Rpm-qa|grep MySQL

    If it exists, continue with the deletion.

    2, RPM-style installation of MySQL

    A) Check to see if MySQL is installed in the RPM package on the system:

    [Email protected] opt]# Rpm-qa | Grep-i MySQL
    mysql-server-5.6.17-1.el6.i686
    mysql-client-5.6.17-1.el6.i686

    b) Uninstall MySQL

    [Email protected] local]# rpm-e mysql-server-5.6.17-1.el6.i686
    [Email protected] local]# rpm-e mysql-client-5.6.17-1.el6.i686

    c) Delete MySQL service

    [Email protected] local]# Chkconfig--list | Grep-i MySQL
    [[email protected] local]# chkconfig--del MySQL

    d) Delete the distributed MySQL folder

    [[email protected] local]# Whereis MySQL or find/-name MySQL

    MySQL:/usr/lib/mysql/usr/share/mysql

    Empty all directories and files related to MySQL
    Rm-rf/usr/lib/mysql
    Rm-rf/usr/share/mysql

    Rm-rf/usr/my.cnf

    With these steps, MySQL should have been completely uninstalled.
  5. 5

    Download and install the latest RPM file

    RPM-UVH http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm

  6. 6

    To install MySQL, enter the command:

    Yum Install Mysql-community-server

  7. 7

    After the installation is complete, enter the command to view the MySQL version number:

    Mysql-v

  8. 8

    To start MySQL, enter the command:

    Service mysqld Start

    Note: If we are starting the MySQL service for the first time, the MySQL server will first initialize the configuration, such as:

    At this point we will see that the first time you start the MySQL server will prompt a lot of information, the purpose is to initialize the MySQL database, when we restart the MySQL service again, will not prompt so much information, such as:

    [Email protected] ~]# service mysqld restart

    When we use MySQL database, we have to start the Mysqld service first, we can through Chkconfig--list | grep mysqld command to see if the MySQL service is booting automatically, such as: [[email protected] ~]# Chkconfig--list | grep mysqld
    We found that the MYSQLD service did not start automatically, we can of course chkconfig mysqld on command to set it to boot, so that you do not have to manually start each time [[email protected] ~]# chkconfig mysqld On
    [Email protected] ~]# Chkconfig--list | grep MySQL

    MySQL database after installation will only have a root administrator account, but at this time the root account has not set a password for it, the first time the MySQL service started, the database will be some initialization work, in the output of a large string of information, we see a line of information:

    So we can use this command to set the password for our root account ( Note : This root account is the root account of MySQL, not the root account of Linux)

    mysqladmin-u root Password ' Root '//Use this command to set the password for the root account you want

Centos Mysql Upgrade

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.