First, the system environment
[Email protected] home]# cat/etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
Second, MySQL installation
Both MySQL and Mysql-devel were installed successfully, but the installation Mysql-server failed with the following:
[Email protected] home]#Yum Install Mysql-server Loaded plugins: 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 (quarter): 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 * up Dates:mirrors.163.com no packages available mysql-server. Error: No processing required
The problem is that the CentOS 7 version removes the MySQL database software from the default program list and replaces it with MARIADB.
There are two ways to solve this problem:
1, method one: Install MARIADB
The MARIADB database management system is a branch of MySQL that uses the GPL-licensed MARIADB to be fully compatible with MySQL, including APIs and command lines, making it easy to be a replacement for MySQL. MARIADB was led by the founder of MySQL Michael Widenius (English: Michael Widenius), who earlier sold his company, MySQL AB, to Sun, and since then, as Sun was acquired by Oracle, MySQL's ownership also falls into Oracle's hands. Mariadb name comes from Michael Widenius's daughter Maria's name.
Install MARIADB, enter the installation command
[Email protected] home]# yum install mariadb-server mariadb
The relevant commands for the MARIADB database are:
Systemctl Start mariadb #启动MariaDB
Systemctl Stop mariadb #停止MariaDB
Systemctl Restart MARIADB #重启MariaDB
Systemctl Enable MARIADB #设置开机启动
Start the database First
[email protected] yl]# systemctl start mariadb
No password by default
[Email protected] 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), Oracle, Mariad B 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 two: official website download installs Mysql-server
# 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 MySQL service after successful installation
# service Mysqld Restart
Initial installation mysql,root Account no password
[Email protected] 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), Oracle and /or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names 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, the MARIADB is automatically replaced and will no longer be in effect.
[Email protected] lzh]# Rpm-qa |grep mariadb
CENTOS7 MySQL Installation