CentOS 7 Installation MySQL 5.6

Source: Internet
Author: User
Tags gpg gpg encryption

Since the CENTOS7 default database is MARIABD, installing MySQL via RPM requires uninstalling the original MARIABD, and then downloading all the dependencies is cumbersome and error-prone. Install it in Yum mode. Yum is actually an upgrade of RPM. It's easy to put all the dependencies into the repository and install all the dependencies automatically.

1. Add the official Yum source

[email protected] ~]# vi /etc/yum. Repos.d/mysql-community.repo

2. Paste the following into the created Yum source file.

[mysql56-Community]name 5.6 Community serverbaseurl=http://repo.mysql.com/yum/mysql-5.6-community/el/7/$basearch/ enabled=1gpgcheck=0gpgkey=file:///etc/pki/ Rpm-gpg/rpm-gpg-key-mysql

Note: Gpgcheck is GPG encryption check, the document value is 1, but check will report errors, so instead of 0 skip check, no impact on the installation, Gpgkey for GPG encryption key, such as in http://repo.mysql.com/ can also be replaced with the use of Gpgcheck.

3. Install MySQL

Yum Install Mysql-community-server

Make sure the network connection is correct before you perform this step or you will get an error.

curl#6"Could not resolve host:repo.mysql.com; Unknown error"

Ask if you want to download Y.

 the MIs This ok [y/d/n]: Y

The hint has replaced the original MARIABD database. No need to unload mariabd save time and effort.

replaced:  mariadb1:5.5. 3. EL7                                          Complete!

4. Start MySQL

[[Email protected] ~]# service mysqld start

5, login to MySQL, with the root user to open MySQL, default no password directly enter.

[Email protected] ~]# Mysql-u root-

6. Modify User Password

Mysql> Select User, Host,password fromMysql.User where User='Root';+------+-----------------------+----------+| User |Host|Password|+------+-----------------------+----------+|Root|localhost|          ||Root|Localhost.localdomain|          ||Root| 127.0.0.1             |          ||Root|::1                   |          |+------+-----------------------+----------+Rowsinch Set(0.00Sec

1) Query user table found password no password, only need to modify the value of password can change the password.

Mysql> UpdateMysql.User SetPassword=Password'123456')where User='Root'; Query OK,4Rows Affected (0.00sec) Rows matched:4Changed:4Warnings:0

2) Check the user table again

Mysql> Select User, Host,password fromMysql.User where User='Root';+------+-----------------------+-------------------------------------------+| User |Host|Password|+------+-----------------------+-------------------------------------------+|Root|localhost| *6bb4837eb74329105ee4568dda7dc67ed2ca2ad9||Root|Localhost.localdomain| *6bb4837eb74329105ee4568dda7dc67ed2ca2ad9||Root| 127.0.0.1             | *6bb4837eb74329105ee4568dda7dc67ed2ca2ad9||Root|::1                   | *6bb4837eb74329105ee4568dda7dc67ed2ca2ad9|+------+-----------------------+-------------------------------------------+Rowsinch Set(0.00Sec

3) found that there is already content in the password, the reason is not 123456 because after the encryption, this is also a point to note, in the change password must remember to write Password=password (' password '), if directly written password will be very miserable, the database does not revoke the function.

7, set the user remote permissions, only need to change the user table in the Host column 127.0.0.1 to%. This change is the IP address of the connecting host, which is changed from this machine to any computer. You can also specify IP instead.

Mysql> UpdateMysql.User SetHost='%' where User='Root'  andHost='127.0.0.1'; Query OK,1Row affected (0.00sec) Rows matched:1Changed:1Warnings:0

Refreshes the table.

MySQL>privileges;

CentOS 7 Installation 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.