Install and configure Mariadb/MySQL in Linux

Source: Internet
Author: User
Tags mysql client mysql in

Since MySQL was acquired by Oracle, the community has been worried that MySQL may be shut down or some other reasons may cause MySQL support problems. So now many versions of the default database are transferred from MySQL to Mariadb. In addition, the community began to strongly support Mariadb. In addition, Mariadb is used exactly the same as MySQL, so Mariadb instead of MySQL is used here.
The MariaDB database management system is a branch of MySQL. It is mainly maintained by the open-source community and licensed by GPL. One of the reasons for developing this branch is that after Oracle acquired MySQL, there is a potential risk of closing the source of MySQL. Therefore, the community uses the branch method to avoid this risk.
MariaDB is designed to be fully compatible with MySQL, including APIs and command lines, so that it can easily become a substitute for MySQL. In terms of storage engine, XtraDB (named Aria) is used to replace InnoDB of MySQL in version 10.0.9.
MariaDB was developed by MySQL founder Michael verenius. He sold his company MySQL AB to SUN for $1 billion earlier, as SUN was acquired by Oracle, the ownership of MySQL also fell into the hands of Oracle. MariaDB name is the name of MariaDB, daughter of Michael verius. ---------- Wikipedia

0X00 installation environment

CentOS 7.x
0X01 view and install Mariadb

Yum list mariadb * can list many software packages related to Mariadb.
We choose to install the server
Yum install mariadb-server
Install the client again (it's okay to use the MySQL client)
Yum install mariadb
0X02 open the Mariadb service and configure the root password

Start the Mariadb service. In CentOS7.x, we recommend that you use systemctl to configure the service startup mode.
Systemctl start mariadb. service
Or
/Etc/init. d/mariadb start
Then configure the root password (you are not mistaken, that is, mysqladmin)
/Usr/bin/mysqladmin-u root password '123'
Now, you can log on to your local database with the root user and '123' password.
0X03 enable remote access

As a database service, you must support remote access, right? You can't always access your database to the data center or even Alibaba cloud data center every time.
First, disable the firewall (preferably open the database port (3306 by default ))
Setenforce 0
Or
Systemctl stop firewalld. service
Plan:
Allow 123.123.123.123 to log on by using the "root" user with the password "123456"
Grant all PRIVILEGES on discuz. * to root @ '192. 123.123.123 'identified by '123 ';
Plan B:
Myuser uses mypassword to connect to the mysql server from any host.
Mysql> grant all privileges on. TO 'myuser' @ '% 'identified BY 'mypassword' with grant option;
Allow myuser to connect to the mysql server from the host whose ip address is 192.168.1.3 and use mypassword as the password
Mysql> grant all privileges on. TO 'myuser' @ '192. 168.1.3 'identified BY 'mypassword' with grant option;
0X03 remote connection

Mysql-h 122.122.122.122-u root-p
Login successful -_-

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.