MySQL installation and configuration method graphic tutorial (CentOS7)

MySQL installation and configuration method graphic tutorial (CentOS7)

1. System environment

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

CentOS Linux release 7.2.1511 (Core)

2. MySQL installation

The installation of mysql and mysql-devel was successful, but the installation of mysql-server failed, as follows:

[root@localhost 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 
 (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
 * updates: mirrors.163.com
 No package mysql-server available.
 Error: No action required

This problem occurs because the CentOS 7 version removes the MySQL database software from the default program list and replaces it with mariadb

There are two solutions:

Method 1 : Install mariadb

MariaDB database management system is a branch of MySQL. It adopts GPL license. The purpose of MariaDB is to be fully compatible with MySQL, including API and command line, so that it can easily become a substitute for MySQL. MariaDB was developed by Michael Widenius, the founder of MySQL. He had previously sold his company MySQL AB to SUN. After that, with SUN being acquired by Oracle, the ownership of MySQL also fell into the hands of Oracle. MariaDB is named after Michael Widenius' daughter Maria.

Install mariadb, enter the installation command

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

The relevant commands for the mariadb database are:

 systemctl start mariadb #Start MariaDB
 systemctl stop mariadb #Stop MariaDB
 systemctl restart mariadb #Restart MariaDB
 systemctl enable mariadb #Set boot startup

Start the database first

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

No password by default

[root@localhost lzh]# mysql -u root -p
Enter password: 
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 6
Server version: 5.5.52-MariaDB MariaDB Server

Copyright (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)

Method 2: Download and install mysql-server from 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

After successful installation, restart the mysql service

# service mysqld restart

When installing MySQL for the first time, 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 3
Server 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 its
affiliates. Other names may be trademarks of their respective
owners.

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

Wonderful topic sharing: Installation tutorials for different versions of MySQL Installation tutorials for MySQL 5.7 versions Installation tutorials for MySQL 5.6 versions

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • Detailed steps to send emails using triggers in SQL Server
  • Some methods to optimize query speed when MySQL processes massive data
  • Summary of common optimization operations of MySQL database (experience sharing)
  • Detailed explanation of the use of Join in Mysql
  • MySQL 5.7 installation MySQL service cannot be started but the service does not report any errors
  • SQL Get all the implementation methods of the parent

<<:  Linux method example to view all information of the process

>>:  In-depth explanation of closure in JavaScript

Recommend

jQuery plugin to implement floating menu

Learn a jQuery plugin every day - floating menu, ...

Detailed explanation of the benefits of PNG in various network image formats

BMP is an image file format that is independent o...

An article to help you thoroughly understand position calculation in js

Table of contents introduction scroll Element.scr...

How to import Chinese data into csv in Navicat for SQLite

This article shares with you the specific method ...

Causes and solutions for MySQL master-slave synchronization delay

For historical reasons, MySQL replication is base...

How to install and deploy zabbix 5.0 for nginx

Table of contents Experimental environment Instal...

JavaScript article will show you how to play with web forms

1. Introduction Earlier we introduced the rapid d...

Vue custom encapsulated button component

The custom encapsulation code of the vue button c...

Zabbix uses PSK shared key to encrypt communication between Server and Agent

Since Zabbix version 3.0, it has supported encryp...

In-depth understanding of the implementation principle of require loader

Preface We often say that node is not a new progr...

Handwritten Vue2.0 data hijacking example

Table of contents 1: Build webpack 2. Data hijack...

HTML realizes real-time monitoring function of Hikvision camera

Recently the company has arranged to do some CCFA...

How to modify the default submission method of the form

The default submission method of html is get inste...

How to change MySQL character set utf8 to utf8mb4

For MySQL 5.5, if the character set is not set, t...

Meta viewport makes the web page full screen display control on iPhone

In desperation, I suddenly thought, how is the Sin...