Mariadb简介、安装和简单使用

这篇具有很好参考价值的文章主要介绍了Mariadb简介、安装和简单使用。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

1 mariadb

1.1 简介

1、介绍

MariaDB是MySQL关系数据库管理系统的一个分支,由社区开发,有商业支持,旨在继续保持在GNU GPL下开源。MariaDB的开发是由MySQL的一些原始开发者领导的,他们担心甲骨文公司收购MySQL后会有一些隐患。
MariaDB打算保持与MySQL的高度兼容性,与MySQL API和命令精确匹配。MariaDB自带了一个新的存储引擎Aria,它可以替代MyISAM,成为默认的事务和非事务引擎。它最初使用XtraDB作为默认存储引擎, 并从10.2版本切换回InnoDB。
MariaDB 是一个快速、可扩展、性能一流的数据库,支持更多存储引擎。它还维护许多插件、工具和实用程序,使其成为最好的数据库之一。 MariaDB 主要用于维护库存、管理交易和客户信息。

2、版本说明

MariaDB直到5.5版本,均依照MySQL的版本。因此,使用MariaDB5.5的人会从MySQL 5.5中了解到MariaDB的所有功能。
从2012年11月12日起发布的10.0.0版开始,不再依照MySQL的版号。10.0.x版以5.5版为基础,加上移植自MySQL 5.6版的功能和自行开发的新功能。
mariadb,服务,mariadb,数据库

3、支持mariadb的客户端

MariaDB的API和协议兼容MySQL,另外又添加了一些功能,这意味着,所有使用MySQL的连接器、程序库和应用程序也将可以在MariaDB下工作。在此基础上,由于担心甲骨文MySQL不再开源,Fedora等Linux发行版已经在最新版本中以MariaDB取代MySQL维基媒体基金会的服务器同样也使用MariaDB取代了MySQL。
以下是支持mariadb的客户端:

  • DBEdit:一个免费的MariaDB数据库和其他数据库管理应用程序。
  • Navicat:一系列Windows、Mac OS X、Linux下专有数据库管理应用程序。
  • HeidiSQL:一个Windows上自由和开放源码的MySQL客户端。它支持MariaDB的5.2.7版本和以后的版本。
  • phpMyAdmin:一个基于网络的MySQL数据库管理应用程序

1.2 在Ubuntu 22.04安装配置mariadb – 使用apt

1、安装

# 更新系统
sudo apt update && sudo apt upgrade

# 安装mariadb的依赖包
sudo apt-get install wget software-properties-common dirmngr ca-certificates apt-transport-https -y

# 安装mariadb
sudo apt install mariadb-server mariadb-client -y

# 查看是否安装成功
# 查看数据库的版本,两个命令都可以
mariadb -V
mariadb --version

# 检查MariaDB的状态
systemctl status mariadb.service

mariadb,服务,mariadb,数据库
mariadb,服务,mariadb,数据库文章来源地址https://www.toymoban.com/news/detail-860851.html

2、保护数据库 - 做一些基本设置

# 保护数据库
# 在 MariaDB 中执行一些基本配置
root@sftp:~# 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
haven't set the root password yet, you should just press enter here.
# 输入当前用户的密码:回车键即可
Enter current password for root (enter for none): 
OK, successfully used password, moving on...

Setting the root password or using the unix_socket ensures that nobody
can log into the MariaDB root user without the proper authorisation.

You already have your root account protected, so you can safely answer 'n'.

Switch to unix_socket authentication [Y/n] y
Enabled successfully!
Reloading privilege tables..
 ... Success!


You already have your root account protected, so you can safely answer 'n'.
# 修改root用户密码
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.
# 是否允许root用户远程登录
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.
# 是否删除test数据库
Remove test database and access to it? [Y/n] n
 ... skipping.

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!
root@sftp:~# 

# 再次查看是否正确启动
systemctl status mariadb

3、在Linux上使用

mariadb
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 40
Server version: 10.6.16-MariaDB-0ubuntu0.22.04.1 Ubuntu 22.04

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

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
# 创建admin 用户,该帐户将具有与 root 帐户相同的权限,但主要是用它进行基于密码的身份验证。
MariaDB [(none)]> GRANT ALL ON *.* TO 'admin'@'localhost' IDENTIFIED BY 'admin123' WITH GRANT OPTION;
Query OK, 0 rows affected (0.001 sec)

MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.000 sec)

# 查看用户
MariaDB [(none)]> select Host,User,Password from mysql.user;
+-----------+-------------+-------------------------------------------+
| Host      | User        | Password                                  |
+-----------+-------------+-------------------------------------------+
| localhost | mariadb.sys |                                           |
| localhost | root        | *73DD6548518E0C6AE598554B04A458A70F7FD616 |
| localhost | mysql       | invalid                                   |
| localhost | admin       | *73DD6548518E0C6AE598554B04A458A70F7FD616 |
+-----------+-------------+-------------------------------------------+
4 rows in set (0.002 sec)

# 创建数据库
MariaDB [(none)]> create database testDb;
Query OK, 1 row affected (0.000 sec)

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
| testDb             |
+--------------------+
5 rows in set (0.000 sec)

1.3 卸载mariadb

systemctl stop mysql
apt remove --purge mariadb\*
apt autoremove
apt autoclean

到了这里,关于Mariadb简介、安装和简单使用的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • 使用MariaDB数据库管理系统

    初始化MariaDB服务 //再确认mariadb数据库软件程序安装完毕并成功启动后请不要立即使用。为了确保数据库的安全性和正常运转,需要做以下5个操作 1.设置root管理员在数据库中的密码值(该密码并非root管理员在系统中的密码,这里的密码值默认应该为空) 2.设置root管理员在数据

    2024年02月19日
    浏览(38)
  • 安卓/鸿蒙手机使用termux安装mariaDB,Centos搭载jdk,Tomcat制作个人移动版服务器

    安卓/鸿蒙手机使用termux安装mariaDB,Centos Centos搭载jdk,Tomcat制作个人移动版服务器。 本来想把数据库也放到Centos上,结果没安装成功,尴尬… 只好把数据库放到termux上(亲测可用,就是性能较差) termux自带jdk,应该可以把Tomcat放在termux上,有空再试试。 以下动作纯手机操作

    2024年02月03日
    浏览(46)
  • 第十六章 使用MariaDB数据库管理系统

    一、数据库管理系统 1、数据库介绍 数据库是指按照某些特定结构来存储数据资料的数据仓库。在当今这个大数据技术迅速崛起的年代,互联网上每天都会生成海量的数据信息,数据库技术也从最初只能存储简单的表格数据的单一集中存储模式,发展到了现如今存储海量数据

    2024年02月05日
    浏览(42)
  • 网站架构演变、LNP+Mariadb数据库分离、Web服务器集群、Keepalived高可用

    目录 day02 深入理解程序的数据存储 验证 配置NFS服务器 配置代理服务器 配置名称解析 程序将文字数据保存到数据库中 程序将非文字数据(如图片、视频、压缩包等)保存到相应的文件目录中 验证 发一篇文章,文章内容包含文字和图片 在数据库中查看文字数据。在最新的一

    2024年02月20日
    浏览(32)
  • 银河麒麟安装mysql数据库(mariadb)-银河麒麟安装JDK-银河麒麟安装nginx(附安装包)

    1.银河麒麟服务器系统安装mysql数据库(mariadb) 2.银河麒麟桌面系统安装mysql数据库(mariadb) 3.银河麒麟服务器系统安装JDK 4.银河麒麟桌面系统安装JDK 5.银河麒麟服务器系统安装nginx 6.银河麒麟桌面系统安装nginx 统信UOS的各种离线全套安装教程: https://blog.csdn.net/ACCPluzhiqi/art

    2024年02月15日
    浏览(34)
  • 安卓Termux系统安装MariaDB结合内网穿透实现公网连接本地数据库

    Android作为移动设备,尽管最初并非设计为服务器,但是随着技术的进步我们可以将Android配置为生产力工具,变成一个随身Linux。 MariaDB是MySQL关系数据库管理系统的一个复刻,由社区开发,有商业支持,旨在继续保持在 GNU GPL 下开源。开发这个分支的原因之一是:甲骨文公司

    2024年04月17日
    浏览(35)
  • 如何在安卓手机Termux上安装MariaDB(MySQL)并实现远程连接数据库

    Android作为移动设备,尽管最初并非设计为服务器,但是随着技术的进步我们可以将Android配置为生产力工具,变成一个随身Linux。 MariaDB是MySQL关系数据库管理系统的一个复刻,由社区开发,有商业支持,旨在继续保持在 GNU GPL 下开源。开发这个分支的原因之一是:甲骨文公司

    2024年02月04日
    浏览(37)
  • linux下卸载,安装mariadb数据库,设置外部访问(二进制包安装和卸载,非docker)

     如果存在,删除服务  删除目录(因为我docker里也安装了mysql,所以根据自己情况删除 ) 下载地址: https://mariadb.org/download  我的数据位置在/usr/local/data/mysql  安装成功  查看数据目录 my.cnf具体配置(网上有很多,找一个就行,但是注意目录的修改)  不修改会报错 报错详情:详细

    2024年02月03日
    浏览(37)
  • 公网环境使用navicat图形化工具远程连接本地MariaDB数据库

    本篇教程将使用cpolar内网穿透本地MariaDB数据库,并实现在外公网环境下使用navicat图形化工具远程连接本地内网的MariaDB数据库。 1. 配置MariaDB数据库 1.1 安装MariaDB数据库 进入MariaDB数据库官网https://mariadb.com/downloads/community/,然后下载相应的windows版本 下载好后点击安装,出现设置

    2024年02月04日
    浏览(49)
  • 统信UOS安装mysql数据库(mariadb)-统信UOS安装JDK-统信UOS安装nginx(附安装包)

    银河麒麟的各种离线全套安装教程: https://blog.csdn.net/ACCPluzhiqi/article/details/131988147 1.统信UOS桌面系统安装mysql(mariadb) 2.统信UOS桌面系统安装JDK 3.统信UOS桌面系统安装nginx 统信UOS服务器操作系统目前没看到有哪家单位使用,基本都是银河麒麟服务器版 所以这里就不介绍统信

    2024年02月15日
    浏览(50)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包