Linux install upgrade Mysql to new version (5.1-5.7) _mysql

Source: Internet
Author: User
Tags mysql client mysql commands mysql version

Today you need to update the MySQL version of the Linux server from 5.1 to 5.7, so the following is a record for future installation manuals

Step one: Check the Linux operating system version

Copy Code code as follows:

Cat/etc/issue

Step two: Download the 5.7 version on the MySQL official web
http://dev.mysql.com/downloads/file.php?id=451627
Step three: Check the MySQL version previously installed on Linux

Copy Code code as follows:

Rpm-qa | grep MySQL

Fourth step: If there are some MySQL installation version, the following command to delete

Copy Code code as follows:

RPM-E--nodeps mysql-xxx

Step Fifth: Prepare to install the new version of Mysql-server

Copy Code code as follows:

RPM-IVH mysql-server-xxxx

Sixth step: Start MySQL server

Copy Code code as follows:

Service MySQL Start

Seventh step: Install MySQL Client
Copy Code code as follows:

RPM-IVH mysql-client-xxx

After I installed, I found that the use of MySQL commands how all landing unsuccessful, and then conducted a series of tests
Finally, from the/usr/share/mysql directory to copy a my-default.cnf to the/etc directory, r case renamed to MY.CNF

Copy Code code as follows:

CP My-default.cnf/etc
MV My-default.cnf MY.CNF

Then add the following under the [Mysqld] node in MY.CNF

Copy Code code as follows:

Skip-grant-tables

and restart MySQL.

Copy Code code as follows:

Service MySQL Restart

Then log in using the Mysql-u-P command
Note: You can use the following command to modify the password

Copy Code code as follows:

Use MySQL;
Update user set Password=password ("Newword") where user= "root";
Flush privileges;

I hope the above content will help you.

MySQL5.1 upgrade to MySQL5.5 version in Linux CentOS6 environment

Old left today in helping friends of the blog to relocate to another VPS host environment, its environment is LLSMP architecture, the original server is LNMP Web site environment, its blog program is WordPress. Told that when the database was imported, "Unknown collation: ' Utf8mb4_unicode_ci '" error prompted, such a problem should be WordPress4.2 version after only, remember not to have such a problem.
See the WordPress official community documentation, mentioned MySQL version of the problem caused, Because the default LLSMP environment MySQL is version 5.1, and the MySQL installed in the LNMP environment is 5.5 version, so the high version is incompatible with the low version, the official recommendation is to upgrade MySQL version 5.5, so I also use this method.

First, backup database and Web site files

Before tossing, we still need to back up the database and the Web page files to local, so that the problem will not affect the current environment and other Web site running.

Second, stop MySQL running and uninstall the old version

Copy Code code as follows:

Service mysqld Stop #暂停MYSQL
Yum Remove MySQL mysql-* #卸载老版本MYSQL

With the above command, we first stop the current MySQL operation, and then uninstall the old MYSQL5.1 version of the database.

Third, check and unload residual mysql-libs

Copy Code code as follows:

Yum List Installed | grep MySQL

We check if there are any remnants of the mysql-libs, and if so, we perform the following command to clear off.

Copy Code code as follows:

Yum Remove Mysql-libs

It does not matter if you do not perform the cleanup.

Iv. upgrading and installation of MYSQL5.5

Here the old left reference online a quick solution, because waiting to go out to work, in this article will not select the version installed, directly using the source package in the 5.5 default installation.

Copy Code code as follows:

RPM-UVH http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
RPM-UVH http://mirrors.neusoft.edu.cn/epel/6/i386/epel-release-6-8.noarch.rpm
RPM-UVH http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
RPM-UVH http://dl.iuscommunity.org/pub/ius/stable/Redhat/6/x86_64/epel-release-6-5.noarch.rpm
RPM-UVH http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

Install some dependent environments first.

Copy Code code as follows:

Yum--enablerepo=remi,remi-test info MySQL mysql-server

And then perform the installation MYSQL5.5
Copy Code code as follows:

Yum--enablerepo=remi,remi-test install MySQL Mysql-server

Execution completed. So far we can check the MySQL version by Mysql-v is already 5.5, but not yet, according to the prompts need to do the configuration file, but do not understand why the old left did not modify the MySQL configuration file can also be implemented, is it providence?
V, start-up and inspection

Copy Code code as follows:

Mysql_upgrade-u root-p

Originally according to the network method is need to modify the configuration file, I did not modify can also be completed, so continue to perform the implementation of the upgrade start, enter the original MySQL root password, let it over again.

When we're done, we start MySQL.

Copy Code code as follows:

Service mysqld Restart

If you can see two green OK, then everything is fine.

Summary so that we can then import the database without coding problems. See a document mentioned can be directly in the export MySQL database when the version of the selection, the back of the old left to try, because the upgrade MySQL has a lot of unrest and trouble, in case of error on the trouble.

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.