MySQL入门——在Linux下安装和卸载MariaDB

摘要:本文主要学习了如何在Linux系统中安装和卸载MariaDB数据库。

查看有没有安装过MariaDB

使用命令查看有没有安装过:

 [root@localhost ~]# yum list installed | grep mariadb
mariadb-libs.x86_64 :5.5.-.el7.centos @anaconda
[root@localhost ~]#

使用的系统是CentOS版本是7.2.1511,可以看到系统只是安装了用到的libs包,并没有安装MariaDB的服务端和客户端。

安装MariaDB

安装

使用命令安装:

 [root@localhost ~]# yum install -y mariadb mariadb-server
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.huaweicloud.com
* extras: mirrors.huaweicloud.com
* updates: mirrors.huaweicloud.com
正在解决依赖关系
--> 正在检查事务
...
完毕!
[root@localhost ~]#

使用命令查看安装的程序:

 [root@localhost ~]# yum list installed | grep mariadb
mariadb.x86_64 :5.5.-.el7_5 @base
mariadb-libs.x86_64 :5.5.-.el7_5 @base
mariadb-server.x86_64 :5.5.-.el7_5 @base
[root@localhost ~]#

启动服务

查看MariaDB的状态:

 [root@localhost ~]# systemctl status mariadb
● mariadb.service - MariaDB database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; vendor preset: disabled)
Active: inactive (dead)
[root@localhost ~]#

启动MariaDB并查看MariaDB的状态:

 [root@localhost ~]# systemctl start mariadb
[root@localhost ~]# systemctl status mariadb
● mariadb.service - MariaDB database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; vendor preset: disabled)
Active: active (running) since 六 -- :: CST; 36s ago
Process: ExecStartPost=/usr/libexec/mariadb-wait-ready $MAINPID (code=exited, status=/SUCCESS)
Process: ExecStartPre=/usr/libexec/mariadb-prepare-db-dir %n (code=exited, status=/SUCCESS)
Main PID: (mysqld_safe)
CGroup: /system.slice/mariadb.service
├─ /bin/sh /usr/bin/mysqld_safe --basedir=/usr
└─ /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/log/mariadb/mariadb.log --pid-file=/var/run/mariadb/mariadb.pid --socke...
...
[root@localhost ~]#

连接数据库

连接并查看版本:

 [root@localhost ~]# mysql -uroot
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is
Server version: 5.5.-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)]> select version();
+----------------+
| version() |
+----------------+
| 5.5.-MariaDB |
+----------------+
row in set (0.00 sec) MariaDB [(none)]>

退出:

 MariaDB [(none)]> exit
Bye
[root@localhost ~]#

简单配置

使用命令对MariaDB进行简单配置:

 [root@localhost ~]# mysql_secure_installation

 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):
OK, successfully used password, moving on...

是否为root用户设置密码:

 Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation. Set 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]
... Success!

是否允许root用户远程登录:

 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]
... Success!

是否删除test数据库:

 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]
- Dropping test database...
... Success!
- 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]
... 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!
[root@localhost ~]#

卸载MariaDB

使用命令卸载安装包:

 [root@localhost ~]# yum remove -y mariadb-libs
已加载插件:fastestmirror
正在解决依赖关系
--> 正在检查事务
...
完毕!
[root@localhost ~]#

查看卸载后的安装情况:

 [root@localhost ~]# yum list installed | grep mariadb
[root@localhost ~]#

表明已经从系统中卸载了。

MySQL入门——在Linux下安装和卸载MariaDB的更多相关文章

  1. MySQL入门——在Linux下安装和卸载MySQL

    MySQL入门——在Linux下安装和卸载MySQL 摘要:本文主要学习了如何在Linux系统中安装和卸载MySQL数据库. 查看有没有安装过MySQL 使用命令查看有没有安装过: [root@loc ...

  2. MySQL入门——在Windows下安装MySQL

    MySQL入门——在Windows下安装MySQL 摘要:本文主要说明了如何下Windows环境下安装MySQL. 查看电脑上是否安装了MySQL 打开cmd窗口,输入 services.msc 命令 ...

  3. linux下安装+配置+卸载jdk

    一. 解压安装jdk在shell终端下进入jdk1.7.0_55.bin文件所在目录, 执行命令 ./jdk1.7.0_55.bin 这时会出现一段协议,连继敲回车,当询问是否同意的时候,输入yes, ...

  4. mysql数据库在Linux下安装与配置

      mysql是一种开放源代码的关系型数据库系统(RDBMS),使用最常用的数据库管理语言--结构化查询语句(SQL)进行数据库管理. 由于mysql的开源,因此任何人都可以在General Publ ...

  5. linux下安装和卸载mysql

      卸载: 1 . rpm -qa | grep -i mysql命令查看已经安装过的组件.   2. 使用yum -y remove命令卸载已经安装的MySQL组件,使用下面的命令,对于上面已经安装 ...

  6. 【MySql】在Linux下安装MySql数据库

    [参数环境] 1.Host OS:Win7 64bit 2.VM: VMware 11.1.0 3.Client OS:CentOS 6 4.系统中已安装的openssl版本: openssl-1.0 ...

  7. Linux下安装和卸载jdk步骤详述

    安装jdk 1.下载jdk8 jdk下载地址: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-21331 ...

  8. Linux下安装与卸载anaconda

    安装:到安装文件夹的目录下输入 bash Anaconda3-4.1.1-Linux-x86_64.sh 卸载:输入

  9. linux下安装和卸载vmware产品

    1.安装 一般的发行版都不会带有vmware,所以通常是下载安装包来安装. 具体的可以见 http://www.cnblogs.com/oloroso/p/5845227.html 2.卸载 这里主要 ...

随机推荐

  1. 【linux命令 】文件特殊权限(SUID、SGID、SBIT)

    chmod 2770 /home/admins,刚看到这个命令,有点不解,后边770分别表示用户,组,其他人,前面的2不知道代表的是什么意思.百度之后发现2是代表八进制数,也是一种权限,它的三个bit ...

  2. Ubuntu下预览raw格式图片

    默认Ubuntu下资源管理器是不可以直接预览raw格式图片的,这就给查看图片带来很大的不便,下面我们就选择安装UFRaw来预览Raw格式图片 1. 首先在terminal安装UFRaw sudo ap ...

  3. 【Java基础】JDBC简明教程

    目录 1. 常用类 2. JDBC编程步骤 3. 事务处理 4. 数据库连接池 5. JDBC列子代码 6. 使用Apache的JDBC工具类 虽然在平时的开发过程中我们不会直接使JDBC的API来操 ...

  4. ES&IK环境搭建

    本来打算docker安装es,和腾讯云上的服务器相比,一台赤裸裸的本地机,甚至连很多基础的指令都没有,还花样各种报错,对于我这种新手来说简直了,百度啊cddn啊终于整出来了,记录一下: 一:安装依赖 ...

  5. Java题库——Chapter13抽象类和接口

    )What is the output of running class Test? public class Test { public static void main(String[ ] arg ...

  6. Emoji来龙去脉

    1997年,日本人发明,定义在unicode的私有区域. 此时两个字节可以表示emoji. IOS 4在日本支持emoji,使用的是这种私有编码. 2010年,unicode 6.0正式支持emoji ...

  7. Selenium(二):选择元素的基本方法

    1. 选择元素的基本方法 对于百度搜索页面,如果我们想自动化输入爱编程的小灰灰,怎么做呢? 这就是在网页中,操控界面元素. web界面自动化,要操控元素,首先需要选择界面元素 ,或者说定位界面元素 就 ...

  8. Python迭代器(函数名的应用,新版格式化输出)

    1. 函数名的运用 ​ 你们说一下,按照你们的理解,函数名是什么? ​ 函数名的定义和变量的定义几乎一致,在变量的角度,函数名其实就是一个变量,具有变量的功能:可以赋值:但是作为函数名他也有特殊的功能 ...

  9. HTML 本地存储

    HTML 本地存储:优于 cookies. 什么是 HTML 本地存储? 通过本地存储(Local Storage),web 应用程序能够在用户浏览器中对数据进行本地的存储. 在 HTML5 之前,应 ...

  10. ORA-29861: 域索引标记为 LOADING/FAILED/UNUSABLE

    解决方法:select idx_name,idx_status from ctxsys.ctx_indexes;需要重建同步全文索引:alter index  索引名  rebuild online ...