Centos7 installing MySQL

Source: Internet
Author: User
Tags gpg yum repolist

Why write this article, because now on the Internet to find the information is basically wrong, or have errors, look uncomfortable.

In Baidu search Centos7 MySQL wrong is the most outrageous is this article http://jingyan.baidu.com/article/ce436649fec8533773afd385.html in a half-day outfit is MARIADB

Later find some articles, found that the basic is outdated.

Because the direct yum install MySQL is not installed in MySQL!!   But it's loaded with MARIADB! That's because the default warehouse is Mariadb's bag.

That Yum's such a good tool can't be used? Of course there is a solution, I found an article on the official website called "a Quick guide to using the MySQL Yum Repository" is to teach us how to install MySQL with the Yum tool

First add MySQL to the Yum repository (my command is CENTOS7, the other Liunx platform with what command, you do the ha)

Shell > Wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm

Shell > Rpm-ivh mysql-community-release-el7-5.noarch.rpm

And then enter it on the command line.

Shell > Yum repolist all | grep MySQL

Results:

mysql-connectors-community/x86_64 MySQL Connectors Community Enabled:14
Mysql-connectors-community-source MySQL Connectors Community-so Disabled
mysql-tools-community/x86_64 MySQL Tools Community enabled:19
Mysql-tools-community-source MySQL Tools Community-source Disabled
mysql55-community/x86_64 MySQL 5.5 Community Server disabled
Mysql55-community-source MySQL 5.5 Community server-so disabled
mysql56-community/x86_64 MySQL 5.6 Community Server enabled:154
Mysql56-community-source MySQL 5.6 Community server-so Disabled
mysql57-community-dmr/x86_64 MySQL 5.7 Community Server deve disabled
Mysql57-community-dmr-source MySQL 5.7 Community Server deve disabled

A bunch of disabled, only see Enable, you can enter the command

Shell > Yum repolist enabled | grep MySQL

Results:

MYSQL-CONNECTORS-COMMUNITY/X86_64 MySQL Connectors Community 14
mysql-tools-community/x86_64 MySQL Tools Community 19
mysql56-community/x86_64 MySQL 5.6 Community Server 154

Here again most of the sentence, can see first in mysql5.6 is usable, but I want to install now the latest version of 5.7 can do? There is a way.

You need to modify the file to execute the following command

Shell > Vi/etc/yum.repos.d/mysql-community.repo

'll see

[Mysql-connectors-community]
Name=mysql Connectors Community
baseurl=http://repo.mysql.com/yum/mysql-connectors-community/el/7/$basearch/
Enabled=1
Gpgcheck=1
Gpgkey=file:/etc/pki/rpm-gpg/rpm-gpg-key-mysql

[Mysql-tools-community]
Name=mysql Tools Community
baseurl=http://repo.mysql.com/yum/mysql-tools-community/el/7/$basearch/
Enabled=1
Gpgcheck=1
Gpgkey=file:/etc/pki/rpm-gpg/rpm-gpg-key-mysql

# Enable to use MySQL 5.5
[Mysql55-community]
Name=mysql 5.5 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.5-community/el/7/$basearch/
Enabled=0
Gpgcheck=1
Gpgkey=file:/etc/pki/rpm-gpg/rpm-gpg-key-mysql

# 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

# Note:mysql 5.7 is currently in development. For use at your own risk.
# Please read with Sub pages:https://dev.mysql.com/doc/relnotes/mysql/5.7/en/
[MYSQL57-COMMUNITY-DMR]
Name=mysql 5.7 Community Server Development Milestone Release
baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/7/$basearch/
Enabled=0
Gpgcheck=1
Gpgkey=file:/etc/pki/rpm-gpg/rpm-gpg-key-mysql

We only need to change the 5.7 enabled to 1 to 5.6 enabled to 0 on the line. I do not care what version, this piece I have not personally tried to install the default version directly.

With all the work done on top, we can finally use our favorite yum to install

Shell > Yum Install mysql-community-server

installation process omitted, all the way to press Y

After success, start MySQL

Shell > Service mysqld Start

View the status of MySQL

Shell > Service mysqld Status

Now also need to set the root password, delete anonymous users and other settings, I see the other article is very complex, in fact, there is a simple command

Shell > Mysql_secure_installation

The initial password is empty, press ENTER directly, then enter the password you want to set, the other according to your own needs, Y or N

That's all

If there are errors, please contact, learn from each other, improve each other, thank you.

 

Centos7 installing MySQL

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.