Installing the MARIADB under CentOS

Source: Internet
Author: User

1. Install through Yum 1.1, initial preparation

First, you need to go to the MARIADB website (https://downloads.mariadb.org/), find the corresponding CentOS page, and copy the following (depending on the version, may also change):

# MariaDB 10.1 CentOS repository list-created 2016-09-06 09:30 UTC

# http://downloads.mariadb.org/mariadb/repositories/

[MARIADB]

Name = MariaDB

BaseURL = Http://yum.mariadb.org/10.1/centos7-amd64

gpgkey= Https://yum.mariadb.org/RPM-GPG-KEY-MariaDB

Gpgcheck=1

To create a yum library file:

[Email protected]/]# Vi/etc/yum.repos.d/mariadb.repo

Add the copied content from the site (above) to the empty file and save it, and the Yum library from this mariadb is built.

1.2. Installation

Install with Yum and install the server and client by executing the following command:

[email protected]/]# Yum install–y mariadb-server mariadb-client

After the installation is complete, you can start mariadb:

[Email protected]/]# systemctl start Mariadb.service

Set power on auto start:

[Email protected]/]# Systemctl enable Mariadb.service

1.3. Open the Firewall

External access to MARIADB, such as Java and other links, requires 3306 ports, so open 3306 ports are required:

[Email protected]/]# firewall-cmd--permanent--zone=public--add-port=3306/tcp

Success

where the permanent parameter sets the firewall to permanent.

1.4. View the database

After the initial installation, you can view the default database to see if the installation was successful and you need to go to the console of the MARIADB database to view it.

Once installed, no permissions are required to go directly to the console:

[[email protected]/]# MySQL

Welcome to the MariaDB Monitor. Commands End With; or \g.

Your MariaDB Connection ID is 3

Server VERSION:10.1.17-MARIADB MariaDB Server

Copyright (c), Oracle, MariaDB Corporation Ab and others.

Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.

MariaDB [(None)]>

At this point, the representative successfully entered the MARIADB environment.

You can view all of the current databases in the following ways:

MariaDB [(None)]> show databases;

+--------------------+

| Database |

+--------------------+

| Information_schema |

| MySQL |

| Performance_schema |

| Test |

+--------------------+

4 rows in Set (0.06 sec)

MariaDB [(None)]>

1.5. Configure the root user

Root permissions need to be modified in the MySQL database, so you need to enter the MySQL database environment first:

MariaDB [(none)]> use MySQL;

Reading table information for completion of table and column names

Can turn off this feature to get a quicker startup with-a

Database changed

MariaDB [mysql]>

After entering the MySQL database environment, update the password for the root user and give permissions:

MariaDB [mysql]> Update user set Password=password ("xxxxxx") where user= ' root ';

Query OK, 0 rows Affected (0.00 sec)
Rows Matched:4 changed:0 warnings:0

MariaDB [mysql]>

To give the root user permission:

MariaDB [mysql]> flush Privileges;
Query OK, 0 rows Affected (0.00 sec)

MariaDB [mysql]>

Finally, you need to exit and log back in:

MariaDB [mysql]> exit
Bye

[Email protected]/]#

At this point, when you log in again, you need to specify the login user, and you can enter the password directly:

MariaDB [mysql]> mysql-u root-p123456
Welcome to the MariaDB Monitor. Commands End With; or \g.

Your MariaDB Connection ID is 3

Server VERSION:10.1.17-MARIADB MariaDB Server

Copyright (c), Oracle, MariaDB Corporation Ab and others.

Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.

MariaDB [(None)]>

The P parameter (password) needs to be directly spliced with the password.

If you enter only the parameter p, you will be asked to enter the password later:

[Email protected]/]# mysql-u root-p
Enter Password:

This article from the "Millennium of the Covenant" blog, declined to reprint!

Installing the MARIADB under CentOS

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.