Home > Database > Mysql Tutorial > Detailed explanation of MariaDB installation method for the basic use of Mysql_MySQL

Detailed explanation of MariaDB installation method for the basic use of Mysql_MySQL

WBOY
Release: 2016-10-09 08:33:39
Original
1201 people have browsed it

The first time I used mysql was on ubuntu. Now I use centOS 7 of the Red Hat branch in Linux. During installation, I found that MariaDB is usually used instead of mysql. Through data query, I found that Mariadb is one of the branches of mysql. , a version of the mysql branch developed by a team led by the founder of mysql. Because mysql was increasingly closed and slowly updated after being acquired by Oracle, many Linux distributions gradually abandoned this popular open source database, making MySQL popular in various countries. Loss of power among major Linux distributions Due to dissatisfaction with the increasing closure and slow updates of MySQL after its acquisition by Oracle, many Linux distributions gradually abandoned this popular open source database and turned to MariaDB, although PostgreSQL has always been regarded as a direct competitor of MySQL. , however, it seems that the one that really gave it a fatal blow was more like MariaDB, and it will be MariaDB that will give Mysql a fatal blow in the future.

Back to business, let’s talk about MariaDB in detail. In fact, the operation of MariaDb is basically the same as the operation of Mysql, but the performance is improved based on Mysql. At present, the update speed of MariaDB has far exceeded the speed of the Oracle team. After all, he is the founder of Mysql. The team you lead is so reassuring.

MariaDb installation

under linux through

yum install mariadb mariadb-server #询问是否要安装,输入Y即可自动安装
Copy after login

Basic commands for mariaDBde service

[root@127 ~]# systemctl start mariadb.service #启动MariaDB
[root@127 ~]# systemctl stop mariadb.service #停止MariaDB
[root@127 ~]# systemctl restart mariadb.service #重启MariaDB
[root@127 ~]# systemctl enable mariadb.service #设置开机自动启动 [root@127 ~]# systemctl disenable mariadb.service #设置开机自启关闭
Copy after login

Initialize root password

[root@127 ~]# mysql_secure_installation #为初始化账户root添加密码
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):这里填写root密码,如果是第一次初始化密码为空直接敲回车(回车前)
Copy after login

Enter current password for root (enter for none):这里填写root密码,如果是第一次初始化密码为空直接敲回车 (回车后↓)
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
You already have a root password set, so you can safely answer 'n'.
Change the root password? [Y/n] y
New password: 这里填写新的密码
Re-enter new password: 这里填写重复的密码
Password updated successfully!
Reloading privilege tables..
... Success!

By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] y
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] y
... Success!
By default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] y
- Dropping test database...
ERROR 1008 (HY000) at line 1: Can't drop database 'test'; database doesn't exist
... Failed! Not critical, keep moving...
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] y
... Success!
Cleaning up...
All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!# 这里表示修改密码成功
Copy after login

Database login

[root@127 ~]# mysql -uroot -proot        # mysql -u这里是填写的用户名(默认为root) &我是空格& -p这里填写的是密码(默认为空)
Copy after login

 这表示已经进入MariaDBWelcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 23
Server version: 5.5.50-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.
# 通过/h可以查看很多命令
MariaDB [(none)]> 这里是输入sql语句的入口
Copy after login

The above is the installation of MariaDB

The above is the detailed explanation of the MariaDB installation method for the basic use of Mysql introduced by the editor. I hope it will be helpful to you. If you have any questions, please leave me a message and the editor will reply to you in time. Thank you very much for your support of the website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template