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

Source: Internet
Author: User
This article describes how to install and upgrade mysql to the new version (5.1-5.7) in linux. if you need to upgrade mysql from 5.1 to 5.7 on a linux server, refer to the following, the following content will be used as a record to provide the subsequent installation User Manual

Step 1: Check the linux operating system version

The 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

The code is as follows:

rpm -qa | grep mysql

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


The code is as follows:

rpm -e --nodeps mysql-xxx

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


The code is as follows:

 rpm -ivh MySQL-server-xxxx

Step 6: start mysql server

The code is as follows:

service mysql start

Step 7: install the mysql client

The 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


The code is as follows:

cp my-default.cnf /etc  mv my-default.cnf my.cnf

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


The code is as follows:

skip-grant-tables

Restart mysql


The 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.


The 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

The code is as follows:

Service mysqld stop # pause MYSQLyum 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

The 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.


The 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.

The code is as follows:

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

First install some dependent environments.

The code is as follows:

yum --enablerepo=remi,remi-test info mysql mysql-server

Then install MYSQL5.5

The code is as follows:

yum --enablerepo=remi,remi-test install mysql 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

The 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

The 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.

The above is how to install and upgrade mysql to the new version (5.1-5.7) _ MySQL in linux. For more information, see PHP Chinese website (www.php1.cn )!

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.