Mac安装MariaDB数据库

参考资料:

如果你是Mac上的开发者,你可以在OS X上通过Homebrew来简单的获取安装最新稳定版本的MariaDB,接下来我们将一步步的来指导安装MariaDB数据库,如果你的Mac中已经安装好了Xcode和Homebrew的话,则直接跳到第四步。

1. 安装Xcode

使用如下命令来安装Xcode:

xcode-select --install

2. 安装Homebrew

安装Homebrew的命令:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

3. 检查Homebrew

brew doctor

4. 更新Homebrew

如果通过上面的命令检查到Homebrew不是最新的版本,可以通过如下命令来把Homebrew更新到最新:

brew update

5. 确认MariaDB的版本

在Homebrew仓库中确认MariaDB的版本:

brew info mariadb

6. 安装MariaDB

通过如下命令来下载安装MariaDB:

brew install mariadb

7. 运行数据库安装程序

mysql_install_db

8. 运行MariaDB

经过了上面的若干命令,已经安装好了MariaDB数据库,但是MariaDB数据库服务并没有启动,你可以通过这个命令来启动MariaDB数据库服务:

mysql.server start

9. 安全的完成安装

通过上面的启动MariaDB数据库服务,你已经可以连接MariaDB的数据库了,但是还不够安全,通过如下步骤可以完成更全面的设置,如:重设root用户的密码、移除匿名用户、移除默认的test数据库等等

mysql_secure_installation

具体的执行和设置如下:

Bens-MacBook-Pro:10.1.16 ben$ 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...

Setting the root password ensures that nobody can log into the MariaDB

root user without the proper authorisation.

Set root password? [Y/n]

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!

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!

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!

10. 连接MariaDB数据

连接MariaDB数据库的命令:

mysql -u root -p

11. 验证MariaDB版本

MariaDB [(none)]> select @@version;

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

| @@version |

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

| 10.1.14-MariaDB |

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

1 row in set (0.00 sec)

MariaDB基础命令

下面是MariaDB的一些基础使用命令:

-- 显示数据库列表

show databases;

-- 切换到名为mysql的数据库,显示该库中的数据表

use mysql;

show tables;

-- 显示数据表table的结构

desc table;

-- 建数据库A与删数据库A

create database `database_A`;

drop database `database_A`;

-- 建表:

use database_A;

create table table_A(字段列表);

drop table table_A;

-- 显示表中的记录:

select * from table_A;

-- 清空表中记录:

delete from table_A;

mac系统装mysql还是mariadb_Mac安装MariaDB数据库相关推荐

  1. mac系统装mysql还是mariadb_Mac上安装mariadb

    1.查看mariadb包信息 # brew info mariadb mariadb: stable 10.2.6 (bottled) Drop-in replacement for MySQL ht ...

  2. Mac系统下MySQL的下载安装和配置教程

    版本说明 MySQL版本:5.7.23 系统版本:macOS High Sierra 10.13.6 MySQL 没有 6 和 7 这两个大版本,是直接从 5 跳到 8 的 当我们的 MySQL 的版 ...

  3. mac osx 装oracle 11g,macOS 安装Oracle数据库

    一.docker部署: 首先,你需要在Mac中部署Docker,也就是安装Docker.安装Docker分了两种途径,一种是通过terminal终端并下载相关依赖包进行安装,另一种是通过下载dmg格式 ...

  4. brew安装指定版本mysql,Mac 系统为 Valet 开发环境安装指定版本 MySQL

    Mac 系统为 Valet 开发环境安装指定版本 MySQL 由 学院君 创建于1年前, 最后更新于 5个月前 版本号 #3 1547 views 1 likes 0 collects 在 Mac 系 ...

  5. 苹果Mac系统下MySql下载MySQL5.7.25及详细安装图解

    苹果Mac系统下MySql最新版下载MySQL5.7.25及详细安装图解 一.在浏览器当中输入以下地址 https://dev.mysql.com/downloads/mysql/ 二.点击下载 ps ...

  6. Mac系统清理软件有必要安装CleanMyMac吗 Mac电脑怎么彻底清理卸载的软件

    因为Mac电脑相比与其他品牌电脑有着较大优势,例如:流畅的Mac系统,强大的设备互联能力等,所以现在使用Mac电脑的人越来越多.与此同时,对于Mac电脑需不需要清理软件的讨论越来越多,究竟需不需要在M ...

  7. Mac系统下vue脚手架的安装与使用

    Mac系统下vue脚手架的安装与使用 1.安装 安装vue前,首先安装node,在官网下载安装包,然后直接安装即可,地址链接: nodejs官网 打开终端,输入命令:sudo npm install ...

  8. 在Linux虚拟机安装MariaDB数据库

    1. 下载MariaDB数据库 测试: 当前虚拟机是否可以正确的链接外网. 命令: [root@localhost src]# yum install mariadb-server 安装mariadb ...

  9. linux安装mariadb数据库

    1. 安装mariadb数据库 1. 在linux系统安装mariadb数据库 命令: yum install mariadb-server -- 安装mariadb数据库 如果安装失败执行此命令: ...

最新文章

  1. spl_autoload_register与autoload区别
  2. FPGA之道(35)Verilog中的并行与串行语句
  3. 懂AI值百万年薪?你不知道的开发者薪资榜单大盘点
  4. linux c ftp断点续传,求个支持断点续传的ftp脚本
  5. 2015.7.11js-10(无缝滚动)
  6. 撤销EXCLE工作表保护密码
  7. centos6 系统安装 system-config-kickstart 工具
  8. Atitit 个人信息数据文档知识分类
  9. Verilog实现数字时钟
  10. ffmpeg安装及在java中的使用案例
  11. iOS 抽奖程序 可指定版
  12. 毛不易 胡同 伴奏 高品质定制纯伴奏
  13. 3D Slicer 中导入STL文件
  14. PEP8 python规范神器和jupyter notebook主题更改--Jupyter Notebook 快速入门
  15. EFR32MG21 with ADXL346
  16. Gradle下载spring包出现Received status code 401 from server: Unauthorized
  17. python 接口自动化unittest+DingtalkChatbot钉钉机器人消息封装
  18. ElasticSearch实现商品搜索与聚合分析
  19. python 腾讯视频签到_云函数实现腾讯视频vip自动签到
  20. 【翻译】云原生项目和团队文化为安联直属公司的CI/CD能力提供动力

热门文章

  1. jdbc连接mysql(基础)
  2. 使用javascript和jquery获取类方法
  3. WampServer的下载方法
  4. Proxmox VE退出集群模式
  5. 为什么天下布魔维护服务器进不去,2017年3月9日服务器停机维护公告
  6. centos7自动获取ip命令_突然断网?专业分析宽带拨号和自动获取ip哪个好?
  7. GitHub+Hexo 搭建个人博客(一)
  8. Bugku CTF web 你必须让他停下来 解题思路
  9. IDaaS 服务的三大场景 B2E/B2C/B2B
  10. Hadoop 数据仓库工具——Hive