Upgrade mysql in centOs and mysql in centOs

Source: Internet
Author: User

Upgrade mysql in centOs and mysql in centOs

Preface: A variety of problems occurred when I upgraded the mysql version from 5.1 to 5.7 On centOS today. However, after a step-by-step investigation, the problem is solved. The following is a record of the process, 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 it:
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 mysqlps -ef | grep -i mysqlrm -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 namerpm -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 256 or 384 for 4G memory. 12 key_buffer_size = 256 M 13 # Each time a table is opened, data will be 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 table scanning 18 read_buffer_size = 256 K 19 # Read rows in any order 20 read_rnd_buffer_size = 512 K 21 # query content transmitted to the network 22 net_buffer_length = 8 K 23 # Number of threads stored in the cache, 24 thread_cache_size = 20 25 # Some tables in the project are frequently added, deleted, and modified, but query also occupies a large part, you also need to observe the relationship between 26 query_cache_size = 8 M 27 # and the number of cpu cores twice after the project runs. I am using ECs, after this parameter is set, it cannot start up. 28 # thread_concurrency = 12 29 30 # the time point at which data is written to the disk after the transaction is committed. If this parameter is set to 2, there can be no 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 through 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 statementmysql> set password = password("root");Query OK, 0 rows affected (0.00 sec)

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

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.