CentOS7 Yum install MySQL 5.6

Source: Internet
Author: User
Tags gpg mysql version yum repolist

1. Download MySQL Yum Repository
wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm


2. Add MySQL Yum Repository
RPM-IVH mysql-community-release-el7-5.noarch.rpm

3, verify whether to add the success
Yum Repolist enabled | grep "Mysql.*-community.*"

4. Select to enable MySQL version

View MySQL version, execute yum repolist all | grep MySQL
You can see that version 5.5, 5.7 is disabled by default because the latest stable version is now 5.6

You can start some versions by using a statement similar to the following
Yum-config-manager--disable mysql56-community
Yum-config-manager--enable MYSQL57-COMMUNITY-DMR

or by modifying the/etc/yum.repos.d/mysql-community.repo file
# Enable to use MySQL 5.6
[Mysql56-community]
Name=mysql 5.6 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.6-community/el/7/$basearch/
Enabled=1
Gpgcheck=1
Gpgkey=file:/etc/pki/rpm-gpg/rpm-gpg-key-mysql

Where enabled=0 refers to disable, enabled=1 means enable.
Note: Only one version can be enabled at any time.

5. Install MySQL via Yum
Yum Install Mysql-community-server

6. MySQL Security settings (set password)
Mysql_secure_installation;

7. Remote Access settings
Create a normal user sa with a password of Some_pass
CREATE USER ' sa ' @ '% ' identified by ' some_pass ';

Grant this user permission to Select,insert,update,delete remote access, which is typically used to provide system access to the implementation
GRANT select,insert,update,delete on * * to ' sa ' @ '% ';

Create an Admin user admin account, password is Some_pass
CREATE USER ' admin ' @ '% ' identified by ' some_pass ';

Grant all remote access permissions to this user. This user is mainly used to manage the entire database, backup, restore and other operations.
GRANT all on * * to ' admin ' @ '% ';

Make authorization effective immediately
Flush privileges;

8. Set character Sets

In general, in order to support Chinese, we should speak the character set as UTF-8, execute the following command to view the current MySQL character set
SHOW VARIABLES like ' character% ';

Modify the/etc/my.cnf file to add settings for the character set

[Mysqld]
Character_set_server = UTF8

[MySQL]
Default-character-set = UTF8

To restart MySQL, you can see that the character set has been modified

9, Backup, restore

Backup
Mysqldump--socket=/home/data/mysql/mysql.sock--single-transaction=true-u root-p emsc > Emsc.sql

Restores
MySQL--socket=/home/data/mysql/mysql.sock-u root-p emsc < Emsc.sql

CentOS7 Yum install MySQL 5.6

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.