CentOS 6.5 mysql5.7 installation tutorial, centosmysql5.7

Source: Internet
Author: User

CentOS 6.5 mysql5.7 installation tutorial, centosmysql5.7

I. New Features

MySQL 5.7 is an exciting milestone. Based on the default InnoDB engine, new features such as ssl, json, and virtual columns are added. Compared with postgreSQL and MariaDB, MySQL5.7 has done a lot of "commit" operations.

Ii. Upgrade operations

1. Uninstall the old version

1.1 view MySQL

rpm -qa|grep mysqlrpm -qa|grep mariadb

1.2 uninstall MySQL

rpm -e --nodeps mysql-5.1.73-7.el6.x86_64rpm -e --nodeps mysql-connector-odbc-5.1.5r1144-7.el6.x86_64rpm -e --nodeps mysql-libs-5.1.73-7.el6.x86_64rpm -qa|grep mysql

1.3 Delete A DATA DIRECTORY

ls -l /var/lib|grep mysqlrm -rf /var/lib/mysql

The data directory can be backed up and removed. During initialization, The mysqld service checks whether the data directory exists. If the data directory does not exist, mysqld creates it. If the data directory exists, if the directory is not empty (including a file or subdirectory), mysqld displays an error message and terminates it:
[ERROR] -- initialize specified but the data directory exists. Aborting.

2. Install MySQL5.7

2.1 decompress MySQL5.7

tar -xvf mysql-5.7.14-1.el6.x86_64.rpm-bundle.tar

By the way, the installation environment is CentOS6.5, so the el6 installation package should be selected; The el7 installation package should be selected for CentOS7.

If the system version corresponding to the installation package is incorrect, A glibc dependency error occurs during installation:

Warning:Mysql-community-libs-5.7.14-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Error: Failed dependencies:
Libc. so.6 (GLIBC_2.14) (64bit) is needed by mysql-community-libs-5.7.14-1.el7.x86_64

2.2 install the rpm package in sequence based on dependencies

The dependency is "common"> "libs"> "client"> "server ".

rpm -ivh mysql-community-common-5.7.14-1.el6.x86_64.rpmrpm -ivh mysql-community-libs-5.7.14-1.el6.x86_64.rpmrpm -ivh mysql-community-client-5.7.14-1.el6.x86_64.rpmrpm -ivh mysql-community-server-5.7.14-1.el6.x86_64.rpm

Do not think about laziness. The client also needs to be installed ···

3. initialize MySQL5.7

3.1 start the mysqld service

Cd ../sbin is/usr/sbin Directory service mysqld start

No manual initialization required. The startup time is long. Please wait.

3.2 check the running status of mysqld

service mysqld status

Now we can determine that MySQL is successfully installed.

3.3 find the temporary logon Password

vi /var/log/mysqld.log

You can also use this command to quickly find cat/var/log/mysqld. log | grep password to find the random password and then log on to MySQL.

3.4 Login

mysql -uroot -p

4. Configure MySQL Remote Access

4.1 modify the root password

alter user 'root'@'localhost' identified by 'abc@123';

After 5.6, mysql has a built-in password enhancement mechanism, and an error will be reported when the password is low:

ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

4.2 Add a remote login user

use mysql;GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'abc@123' WITH GRANT OPTION;

'%' Indicates any address. You can also specify an IP address.

4.3. Check the user table and refresh the memory permission.

select host, user from user;FLUSH PRIVILEGES;

4.4 Set firewall

vi /etc/sysconfig/iptables

Before-A RH-Firewall-1-INPUT-j REJECT-reject-with icmp-host-prohibited, add

-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT

4.5 restart the Firewall

service iptables restart

The above is all the content of this article. I hope it will be helpful for your learning and support for helping customers.

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.