Centos7 mysql installation, centos7mysql

Source: Internet
Author: User

Centos7 mysql installation, centos7mysql
I. System Environment

[Root @ localhost home] # cat/etc/redhat-release

CentOS Linux release 7.2.1511 (Core)

Ii. Install mysql

The installation of mysql and mysql-devel is successful, but the installation of mysql-server fails as follows:

[Root @ localhost home] # yum install mysql-server loaded plug-in: fastestmirror, langpacks Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast base | 3.6 kB 00:00:00 extras | 3.4 kB 00:00:00 updates | 3.4 kB 00:00:00 (1/4): base/7/x86_64/group_gz | 155 kB 00:00:01 (2/4 ): extras/7/x86_64/primary_db | 139 kB 00:00:01 (3/4): base/7/x86_64/primary_db | 5.6 MB 00:00:38 (4/4 ): updates/7/x86_64/primary_db | 4.7 MB 00:00:39 Loading mirror speeds from cached hostfile * base: mirrors.163.com * extras: mirrors.163.com * u Pdates: mirrors.163.com there is no available mysql-server software package. Error: No need to handle

This problem occurs when MySQL database software is removed from the default program list in CentOS 7 and replaced by mariadb.

There are two solutions:

1. Method 1: Install mariadb

The MariaDB database management system is a branch of MySQL. The purpose of using GPL to authorize MariaDB is to be fully compatible with MySQL, including APIs and command lines, so that it can easily become a substitute for MySQL. MariaDB was developed by Michael Widenius, the founder of MySQL. He sold his own company MySQL AB to SUN. Since then, as SUN was acquired by Oracle, the ownership of MySQL also falls into the hands of Oracle. MariaDB is named by Michael Widenius's daughter Maria.

Install mariadb and enter the installation command

[Root @ localhost home] # yum install mariadb-server mariadb

The commands related to the mariadb database are:

Systemctl start mariadb # start MariaDB

Systemctl stop mariadb # stop MariaDB

Systemctl restart mariadb # restart MariaDB

Systemctl enable mariadb # Set startup

Start the database first

[Root @ yl-web yl] # systemctl start mariadb

No password by default

[root@localhost lzh]# mysql -u root -pEnter password: Welcome to the MariaDB monitor.  Commands end with ; or \g.Your MariaDB connection id is 6Server version: 5.5.52-MariaDB MariaDB ServerCopyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> show databases;+--------------------+| Database           |+--------------------+| information_schema || mysql              || performance_schema || test               |+--------------------+4 rows in set (0.01 sec)
2. Method 2: download and install mysql-server on the official website
# wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm# rpm -ivh mysql-community-release-el7-5.noarch.rpm# yum install mysql-community-server

Restart the mysql service after successful installation.

# Service mysqld restart

The first time mysql is installed, the root account has no password

[root@localhost lzh]# mysql -u root Welcome to the MySQL monitor.  Commands end with ; or \g.Your MySQL connection id is 3Server version: 5.6.26 MySQL Community Server (GPL)Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> show databases;+--------------------+| Database           |+--------------------+| information_schema || mysql              || performance_schema || test               |+--------------------+4 rows in set (0.01 sec)

Set Password

mysql> set password for 'root'@'localhost' =password('password');Query OK, 0 rows affected (0.00 sec)

After installation, mariadb is automatically replaced and will no longer take effect.

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

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.