Upgrade MySQL 5.1 to 5.7 in CentOS

Source: Internet
Author: User

Upgrade MySQL 5.1 to 5.7 in CentOS

Today, we encountered various problems when upgrading the MySQL version from 5.1 to 5.7 On CentOS. However, after a step-by-step investigation and solution, we will record the process below, I have gone through many times of uninstallation and deletion. During this record process, I recorded the records in the order of the last successful records, special descriptions are provided for some possible errors.

1. To download Linux 5.7, two files are required.

MySQL-server-5.7.4_m14-1.el6.x86_64.rpm
MySQL-client-5.7.4_m14-1.el6.x86_64.rpm

2. Back up database files

Mysqldump-uxxx-pxx databasename> databasename. SQL

3. Stop mysql Service

Service mysql stop

4. For yum installation, run the following statement to uninstall [plain] view plaincopyprint? Yum remove mysql *

Yum remove mysql *

5. Delete the existing files or data in the old mysql version. Otherwise, mysql may encounter various tangle problems after being installed again.

Find/-name mysql
Ps-ef | grep-I mysql

Rm-rf mysql ****
Kill-9 mysqlid

Note that many files starting with mysql in/usr/bin,/usr/share/,/var/lib are deleted, and my. cnf files under the/etc directory are deleted.

6. If you install rpm, run the following command to delete it:

Rpm-qa | grep-I name
Rpm-e mysqlxxxxx

7. After uninstalling and deleting the files, run the following command to install the downloaded server and client:

Rpm-ivh mysqlxxx

8. I optimized part of my. cnf and made adjustments based on our project requirements.

[Mysqld]
2 datadir =/var/lib/mysql
3 socket =/var/lib/mysql. sock
4 # user = mysql
5
6 # Disabling symbolic-links is recommended to prevent assorted security risks
7 symbolic-links = 0
8 # Set the binary log file directory
9 log-bin = mysql-bin

# An inexplicable error will be reported if 10 rows are not set.

10 server-id = 1
11 # specify the index buffer size. Set the buffer size to 256 or 384 in 4 GB memory.
12 key_buffer_size = 256 M
13 # Each time a table is opened, data is read into table_open_cache,
14 table_open_cache = 256
15 # the buffer size used for order by is for each connection, so it cannot be too large.
16 sort_buffer_size = 256 K
17 # requests for sequential scanning of tables
18 read_buffer_size = 256 K
19 # Read rows in any order
20 read_rnd_buffer_size = 512 K
21 # When the content is queried for Network Transmission
22 net_buffer_length = 8 K
23 # Number of threads stored in the cache,
24 thread_cache_size = 20
25 ## because some tables in the project are frequently added, deleted, and modified, but the query also occupies a large part, you need to observe it for a while after running the project.
26 query_cache_size = 8 M
27 # There is a double relationship with the number of cpu cores. I am using an ECS instance. It cannot be started after this parameter is set.
28 # thread_concurrency = 12
29
30 # The time when data is written to the disk after the transaction is committed. If this parameter is set to 2, the speed can be greatly improved without strong security requirements.
31 innodb_flush_log_at_trx_commit = 2
32
33 # If a permission error or Password error is reported when you log on to the client using the mysql command, you can enable the flag to skip verification, connect directly to mysql, and then modify the user name permission.
34 # skip-grant-tables
35
36 [mysqld_safe]
37 log-error =/var/log/mysqld. log
38 pid-file =/var/run/mysqld. pid

9. the mysql error 1524 error occurred during the installation process. The cause is not found. You can skip the error by setting skip-grant-tables and then error 1045 (28000) error. I commented out user = mysql in Step 8. Some other errors occurred during this process, but I cannot remember them for now. After the above settings, after restarting the mysql service, you can log on through mysql-uxxx-pxx, and an error 1820 occurs. Then, you can check the information and perform the following operations.

Mysql> create database ttt;
ERROR 1820 (HY000): You must set password before executing this statement
Mysql> set password = password ("root ");
Query OK, 0 rows affected (0.00 sec)

10. OK, and the SQL file is imported through the source command.

-------------------------------------- Split line --------------------------------------

Install MySQL in Ubuntu 14.04

MySQL authoritative guide (original book version 2nd) Clear Chinese scan PDF

Ubuntu 14.04 LTS install LNMP Nginx \ PHP5 (PHP-FPM) \ MySQL

Build a MySQL Master/Slave server in Ubuntu 14.04

Build a highly available distributed MySQL cluster using Ubuntu 12.04 LTS

Install MySQL5.6 and Python-MySQLdb in the source code of Ubuntu 12.04

MySQL-5.5.38 universal binary Installation

-------------------------------------- Split line --------------------------------------

This article permanently updates the link address:

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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.