RedHat6.5/CentOS6.5 detailed tutorial on installing Mysql5.7.20,

Source: Internet
Author: User

RedHat6.5/CentOS6.5 detailed tutorial on installing Mysql5.7.20,

Download the rpm installation package

Mysql Official Website: https://dev.mysql.com/downloads/mysql/

Select Version Download:

You can use the wget command to download:

[root@localhost opt]#wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.20-1.el6.x86_64.rpm-bundle.tar

Note the version and number of digits of the RedHat.

View dependent Libraries

[root@localhost opt]# yum search libaio[root@localhost opt]# yum install libaio

Check whether mysql-related versions have been installed in the system.

[root@localhost opt]# rpm -qa | grep mysql[root@localhost opt]# rpm -qa | grep mariadb

If yes, delete it. If yes, delete several

[root@localhost opt]# rpm -e mariadb-libs-5.5.44-2.el7.x86_64 --nodeps

Install

Install software packages in sequence

[root@localhost opt]# rpm -ivh mysql-community-common-5.7.20-1.el6.x86_64.rpm[root@localhost opt]# rpm -ivh mysql-community-libs-5.7.20-1.el6.x86_64.rpm[root@localhost opt]# rpm -ivh mysql-community-client-5.7.20-1.el6.x86_64.rpm[root@localhost opt]# rpm -ivh mysql-community-server-5.7.19-1.el7.x86_64.rpm

Create mysql users and user groups

[root@localhost /]# groupadd mysql[root@localhost /]# useradd -r -g mysql -s /bin/false mysql

Create a mysql data storage directory

[Root @ localhost/] # mkdir-p/data/mysql [root @ localhost/] # chown mysql. mysql/data/mysql [root @ localhost/] # ll-d/data/mysql/drwxr-xr-x. 2 mysql 6 September 17 17:37/data/mysql/

Modify the/etc/my. cnf configuration file

[mysqld]init-connect='SET NAMES utf8mb4'default-storage-engine=INNODBcharacter-set-server=utf8mb4datadir=/data/mysqlsocket=/var/lib/mysql/mysql.sockassorted security riskssymbolic-links=0log-error=/var/log/mysqld.logpid-file=/var/run/mysqld/mysqld.pidvalidate_password=offsql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTIONlower_case_table_names=1[mysql]default-character-set = utf8mb4[client]default-character-set = utf8mb4

Initialize mysql

[root@localhost /]# /usr/sbin/mysqld --initialize --user=mysql

View the initialization Password

[root@localhost /]# grep "root@localhost" /var/log/mysqld.log

Log on to mysql and change the password

mysql> set password = password('123456');

Allow Remote Access (not recommended)

mysql> use mysql; mysql> select host,user,password from user; mysql> update user set password=password('xxxxxx') where user='root'; mysql> update user set host='%' where user='root' and host='localhost'; mysql> flush privileges;

Summary

The above is a detailed tutorial on installing Mysql5.7.20 in RedHat6.5/CentOS6.5. If you have any questions, please leave a message and I will reply to you in time. Thank you very much for your support for the help House website!

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.