Directory
[TOC]
1. View the currently installed Linux version
[[email protected] ~]$ sudo lsb_release -aLSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarchDistributor ID: CentOSDescription: CentOS release 6.9 (Final)Release: 6.9Codename: Final
2. Download the MySQL installation file
Official website http://www.mysql.com
Download Https://downloads.mysql.com/archives/get/file/mysql-5.7.19-1.el6.x86_64.rpm-bundle.tar directly.
3. Clean up the old version MySQL3.1, check if MySQL is installed in the operating system
[[email protected] ~]$ sudo rpm -qa | grep mysqlmysql-5.1.73-8.el6_8.x86_64mysql-server-5.1.73-8.el6_8.x86_64mysql-libs-5.1.73-8.el6_8.x86_64
3.2. Remove the old version of MySQL database installation package
[[email protected] ~]$ sudo rpm -e --nodeps mysql-5.1.73-8.el6_8.x86_64[[email protected] ~]$ sudo rpm -e --nodeps mysql-server-5.1.73-8.el6_8.x86_64[[email protected] ~]$ sudo rpm -e --nodeps mysql-libs-5.1.73-8.el6_8.x86_64
3.3, find the old version of MySQL installation legacy directory and files
[[email protected] ~]$ find / -name mysql/var/lib/mysql
3.4. Delete old version of MySQL installation legacy directory and files
[[email protected] ~]$ sudo rm -rf /var/lib/mysql
4. Install the new version MySQL4.1, unpack the package
[[email protected] softs]$ tar -xvf mysql-5.7.19-1.el6.x86_64.rpm-bundle.tar mysql-community-libs-5.7.19-1.el6.x86_64.rpmmysql-community-devel-5.7.19-1.el6.x86_64.rpmmysql-community-embedded-5.7.19-1.el6.x86_64.rpmmysql-community-common-5.7.19-1.el6.x86_64.rpmmysql-community-libs-compat-5.7.19-1.el6.x86_64.rpmmysql-community-server-5.7.19-1.el6.x86_64.rpmmysql-community-test-5.7.19-1.el6.x86_64.rpmmysql-community-embedded-devel-5.7.19-1.el6.x86_64.rpmmysql-community-client-5.7.19-1.el6.x86_64.rpm
4.2. Install MySQL
[[email protected] softs]$ sudo rpm-ivh mysql-community-common-5.7.19-1.el6.x86_64.rpmwarning: Mysql-community-common-5.7.19-1.el6.x86_64.rpm:header V3 dsa/sha1 Signature, key ID 5072e1f5:nokeypreparing ... ########################################### [100%] 1:mysql-community-common ##################################### ###### [100%][[email protected] softs]$ sudo rpm-ivh mysql-community-libs-5.7.19-1.el6.x86_64.rpmwarning: Mysql-community-libs-5.7.19-1.el6.x86_64.rpm:header V3 dsa/sha1 Signature, key ID 5072e1f5:nokeypreparing ... ########################################### [100%] 1:mysql-community-libs ####################################### # # # # # [100%][[email protected] softs]$ sudo rpm-ivh mysql-community-client-5.7.19-1.el6.x86_64.rpmwarning: Mysql-community-client-5.7.19-1.el6.x86_64.rpm:header V3 dsa/sha1 Signature, key ID 5072e1f5:nokeypreparing ... ########################################### [100%] 1:mysql-Community-client ########################################### [100%][[email protected] softs]$ sudo rpm-ivh Mysql-community-server-5.7.19-1.el6.x86_64.rpmwarning:mysql-community-server-5.7.19-1.el6.x86_64.rpm:header V3 DSA/SHA1 Signature, key ID 5072e1f5:nokeypreparing ... ########################################### [100%] 1:mysql-community-server ########################################### [100%]
4.3. Start MySQL Database
[[email protected] ~]$ sudo service mysqld startinitializing MySQL database: [OK]st Arting mysqld: [OK][[email protected] ~]$ sudo mysqld_safe--user=mysql --skip-grant-tables--skip-networking &[1] 3598[[email protected] ~]$ 2017-11-15t01:58:49.095993z mysqld_ Safe Logging to '/var/log/mysqld.log '. 2017-11-15t01:58:49.129531z mysqld_safe starting mysqld daemon with databases from /var/lib/mysql[[email protected] ~]$ mysql-u root mysqlreading table information for completion of table and column Namesyou can turn off this feature to get a quicker startup With-awelcome to the MySQL Monitor. Commands End With; or \g.your MySQL connection ID is 4Server version:5.7.19 mysql Community Server (GPL) Copyright (c), Oracle and /or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names trademarks of their REspectiveowners. Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.mysql> update user Set authentication_string = password (' root123 ') where user = ' root '; Query OK, 1 row affected, 1 warning (0.01 sec) Rows matched:1 changed:1 warnings:1mysql> flush privileges; Query OK, 0 rows affected (0.01 sec) mysql> quitbye[[email protected] ~]$ sudo service mysqld restartstopping MySQL D: [OK]starting mysqld: [OK][[ Email protected] ~]$ mysql-u root-penter password:welcome to the MySQL monitor. Commands End With; or \g.your MySQL connection ID is 5Server version:5.7.19copyright (c), and Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names trademarks of their respectiveowners. Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.mysql&Gt show databases; ERROR 1820 (HY000): Must reset your password using ALTER USER statement before executing this statement.mysql> set password for [email protected] = password (') Okm9ijn '); Query OK, 0 rows affected, 1 warning (0.01 sec) mysql> flush privileges; Query OK, 0 rows affected (0.02 sec) mysql> Quitbye
4. Telnet 4.1, Authorization
[[email protected] ~]$ mysql-u root-penter password:welcome to the MySQL monitor. Commands End With; or \g.your MySQL connection ID is 22Server version:5.7.19 mysql Community Server (GPL) Copyright (c) #, Oracle an d/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names trademarks of their respectiveowners. Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.mysql> use MySQL; Reading table information for completion of table and column namesyou can turn off this feature to get a quicker startup W Ith-adatabase changedmysql> Select Host, user from user;+-----------+---------------+| Host | User |+-----------+---------------+| localhost | mysql.session | | localhost | Mysql.sys | | localhost | Root |+-----------+---------------+3 rows in Set (0.00 sec) mysql> GRANT all privileges on * * to ' root ' @ '% ' ID Entified by ') Okm9ijn ' with GRANT OPTION; Query OK, 0 rows affected, 1 Warning (0.02 sec) mysql> Select Host, user from user;+-----------+---------------+| Host | User |+-----------+---------------+| % | Root | | localhost | mysql.session | | localhost | Mysql.sys | | localhost | Root |+-----------+---------------+4 rows in Set (0.00 sec) mysql> FLUSH privileges; Query OK, 0 rows affected (0.07 sec)
4.2. Testing
Testing on other machines
C:\>mysql -h 192.168.1.144 -u root -pEnter password: ********Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 23Server version: 5.7.19 MySQL Community Server (GPL)Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.
CentOS 6.9 under MySQL5.7.19 installation steps