Install and upgrade mysql to the new version (5.1-5.7) in linux, and mysql 5.7-

Source: Internet
Author: User

Install and upgrade mysql to the new version (5.1-5.7) in linux, and mysql 5.7-

If you need to update the mysql version on the linux server from 5.1 to 5.7 today, the following content will be used as a record and will be provided with the subsequent installation user manual.

Step 1: Check the linux operating system version

Copy codeThe Code is as follows:
Cat/etc/issue

Step 2: Download mysql 5.7 On the mysql Official Website
Http://dev.mysql.com/downloads/file.php? Id = 451627
Step 3: Check the mysql version installed on linux

Copy codeThe Code is as follows:
Rpm-qa | grep mysql

Step 4: if some mysql installation versions appear, delete them using the following command:

Copy codeThe Code is as follows:
Rpm-e -- nodeps mysql-xxx

Step 5: Prepare to install the new mysql-server version

Copy codeThe Code is as follows:
Rpm-ivh MySQL-server-xxxx

Step 6: Start mysql server
Copy codeThe Code is as follows:
Service mysql start

Step 7: Install the mysql client
Copy codeThe Code is as follows:
Rpm-ivh MySQL-client-xxx

After I installed it, I found that I could not log on successfully using the mysql Command. Then I conducted a series of tests.
Finally, copy a my-default.cnf from the/usr/share/mysql directory to the/etc directory, and rename the r case to my. cnf

Copy codeThe Code is as follows:
Cp my-default.cnf/etc
Music my-default.cnf my. cnf

Add the following content under the [mysqld] node in my. cnf:

Copy codeThe Code is as follows:
Skip-grant-tables

Restart mysql

Copy codeThe Code is as follows:
Service mysql restart

Then use the mysql-u-p command to log on.
Note: You can use the following command to modify the password.

Copy codeThe Code is as follows:
Use mysql;
Update user set password = PASSWORD ("newword") where user = "root ";
Flush privileges;

I hope the above content will be helpful to you.

Upgrade MySQL5.1 to MySQL5.5 in CentOS6

Old Zuo is helping his blog migrate to another VPS host environment today. The environment uses the LLSMP architecture. The original server uses the LNMP website environment, its blog program is WORDPRESS. The error message "Unknown collation: 'utf8mb4 _ unicode_ci '" appears when you import the database. This problem should be generated only after the WordPress4.2 version. I have never remembered this problem.
See the WordPress official Community documentation. This is due to the MYSQL version issue, because MYSQL is version 5.1 by default in the LLSMP environment, and MYSQL is version 5.5 installed in the LNMP environment, therefore, the higher version is incompatible with the lower version. The official recommendation is to upgrade MYSQL 5.5, so I also use this method.

1. Back up databases and website files

We still need to back up the database and webpage files to the local place before the tossing, so as to avoid problems affecting the current environment and the running of other websites.

2. Stop MYSQL and uninstall old versions

Copy codeThe Code is as follows:
Service mysqld stop # Pause MYSQL
Yum remove mysql-* # uninstall old MYSQL versions

Through the above command, we stop the current MYSQL operation first, and then uninstall the old MYSQL database.

3. Check and uninstall the residual mysql-libs
Copy codeThe Code is as follows:
Yum list installed | grep mysql

Check whether there are any residual mysql-libs. If yes, run the following command to clear it.

Copy codeThe Code is as follows:
Yum remove mysql-libs

Run clear. It does not matter if it is not executed.

4. Upgrade and install MYSQL5.5

Here, I would like to refer to a quick solution on the Internet to solve this problem, because I will wait for my work, so I will not choose to install the version in this article. I will directly use the default 5.5 installation in the source package.
Copy codeThe Code is 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

First install some dependent environments.
Copy codeThe Code is as follows:
Yum -- enablerepo = remi, remi-test info mysql-server

Then install MYSQL5.5
Copy codeThe Code is as follows:
Yum -- enablerepo = remi, remi-test install mysql-server

Execution completed. So far, we can use mysql-V to check that the MYSQL version is 5.5, but it still does not work. Configure the file as prompted, but I don't know why the old left does not modify the MYSQL configuration file and can also be executed. Is it Tian Yi?
V. Start and check
Copy codeThe Code is as follows:
Mysql_upgrade-u root-p

The configuration file needs to be modified according to the method on the network, and can be completed without modification. Therefore, we will continue to execute the upgrade and startup, and enter the original mysql root Password.

After that, run MYSQL
Copy codeThe Code is as follows:
Service mysqld restart

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

In summary, the encoding problem will not occur when we import the database again. As mentioned in some documents, you can select a version when exporting the MYSQL database directly. Try it on the left, because there is a lot of anxiety and trouble in upgrading MYSQL, and it will be troublesome if an error occurs.

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.