Mac中MariaDB数据库的安装步骤_mariadb

前言

MariaDB由MySQL的创始人Michael Widenius主导开发,他早前曾以10亿美元的价格,将自己创建的公司MySQL卖给了SUN,此后,随着SUN被甲骨文收购,MySQL的所有权也落入Oracle的手中。MariaDB名称来自Michael Widenius的女儿Maria的名字。那么在Mac中如何安装MariaDB数据库呢?下面小编就给大家介绍Mac中安装配置MariaDB数据库的方法。

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.github.com/Homebrew/homebrew/go/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. 运行数据库安装程序

分别执行下面的命令来实现安装:

unset TMPDIR
cd /usr/local/Cellar/mariadb/10.0.10/
mysql_install_db 

8. 运行MariaDB

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

mysql.server start 

9. 安全的完成安装

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

具体的执行和设置如下:

➜ 10.1.14: 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):
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
Enter current password for root (enter for none):
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
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] 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] n
 ... skipping.

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

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中安装MariaDB数据库的全部步骤,大家都学会了吗?希望这篇文章的内容对大家的学习能有所帮助,如果有疑问大家可以留言交流。

以上是小编为您精心准备的的内容,在的博客、问答、公众号、人物、课程等栏目也有的相关内容,欢迎继续使用右上角搜索按钮进行搜索安装
, mac
, mariadb
安装配置
mac mariadb 安装、mysql数据库安装步骤、数据库安装步骤、oracle数据库安装步骤、sql数据库安装步骤,以便于您获取更多的相关知识。

时间: 2024-09-19 09:07:36

Mac中MariaDB数据库的安装步骤_mariadb的相关文章

Mac上Oracle数据库的安装及过程中一些问题的解决_oracle

1. 访问Oralce 的官网,下载相关压缩包 http://www.oracle.com/technetwork/topics/intel-macsoft-096467.html 注意:在mac 山狮操作系统下,要下载x86 即 32位版本.不能用 64位的.否则 navicat 也不能使用 2. 把所有的文件压缩到 一个目录下(我用的是 /desktop/oracle) 3.把这个oralce 目录复制到 /opt 目录下 在/opt 目录下就有 /opt/oracle/instantcli

ASP.NET中操作数据库的基本步骤分享_实用技巧

1.ASP.NET操作数据库的基本步骤: ASP.NET数据操作常用方法: a. ExecuteReader() 返回的是一个SqlDataReader对象或OleDbDataReader对象,每次返回或操作指引一个记录保存在服务器的内存中. 相对 DataSet而言,具体较快的访问能力,通常用来进行查询操作. b.ExecuteNonQuery() c.ExecuteScalar()返回的是Object类型.如果执行的是SELECT,则返回结果是查询后的第一行第一列 返回数据库中影响的行数,进

MSSQL中系统数据库master迁移步骤

1.在单用户模式下启动服务器实例. 有关如何指定单用户引导参数 (-m) 的信息,请参阅 配置服务器启动选项(SQL Server 配置管理器). 配置启动选项 在 SQL Server 配置管理器中,单击"SQL Server 服务". 在右窗格中,右键单击 SQL Server (<instance_name>),然后单击"属性". 在"启动参数"选项卡上的"指定启动参数"框中,键入该参数,然后单击"

CentOS系统中Redis数据库的安装配置指南_Redis

1.检查安装依赖程序 yum install gcc-c++ yum install -y tcl yum install wget 2.获取安装文件 wget http://download.redis.io/releases/redis-2.8.13.tar.gz 3.解压文件 tar -xzvf redis-2.8.19.tar.gz mv redis-2.8.19 /usr/local/redis 4.进入目录 cd /usr/local/redis 5.编译安装 make make i

ubuntu系统中Nginx环境配置安装步骤

安装nginx sudo apt-get install nginx Ubuntu安装之后的文件结构大致为:     所有的配置文件都在/etc/nginx下,并且每个虚拟主机已经安排在了/etc/nginx/sites-available下     程序文件在/usr/sbin/nginx     日志放在了/var/log/nginx中     并已经在/etc/init.d/下创建了启动脚本nginx     默认的虚拟主机的目录设置在了/var/www/nginx-default (有的

10g,11g中的数据库克隆安装

有时候在很多工作环境中,如果彼此几个机器的配置相似,我们就可以不用一遍又一遍的安装数据库软件了,我们可以为了更快的完成安装工作,在静默安装,图形安装的选择之外,还有克隆安装.不过在10g,11g的版本中还是存在一定的差别.虽然方法有差别,但是思路都是一致的. 我们可以从源环境中直接把ORACLE_HOME给打个包,在目标环境解压即可.这个时候尽管你去尝试sqlplus,exp这些工具也能用,但是还是存在很大的风险,毕竟别把它当成绿色版的.出了问题谁都兜不住. 11g的环境中,可以使用下面的方式来

DirectAdmin面板中MariaDB代替MySQL配置步骤

DirectAdmin 是目前比较常见而且也有许多主机商正在使用的控制面板,廉价.简单.易用   目前 Custombuild 甚至已经提供 lampn 的环境了,但是 MySQL 的效率仍然是饱受诟病.我也是自用的 DirectAdmin 控制面板,在我安装的时候就已经是避免了安装 MySQL,为此.各位和我一样的童鞋可以按照如下的方式安装 MariaDB. 一.源 先加入官方源  代码如下 复制代码 vim /etc/yum.repos.d/MariaDB.repo 在其中加入如下内容 32

MAC中快速安装卸载大型软件的技巧

  MAC新手用户们一定都想知道MAC系统是不是也可以通过Setup.exe之类的文件进行软件安装.其实这个在MAC系统中是可以做到的,今天小编就给介绍一下这种方法吧,有兴趣的用户可以看看. 安装软件: 获得了光盘或DMG文件后我们挂接到系统上,进入镜像中很直观的就能找到安装程序用的执行文件,一般是不会找错的.(如下图) 之后会出现一些关于版权信息或安装配置的步骤,再下一步就开始安装了,在安装完成前的最后一步就是更新系统相关的配置信息,在Mac OS X上几乎所有大型软件的安装都会进行系统配置信

CentOS6.7系统中编译安装MariaDB数据库_mariadb

环境:CentOS6.7,minimal安装. 前提条件:安装了编译环境,安装了Apache. 1.下载解压 # wget http://archive.mariadb.org//mariadb-5.5.44/bintar-linux-x86/mariadb-5.5.44-linux-i686.tar.gz # tar xf mariadb-5.5.44-linux-x86_64.tar.gz -C /usr/local # cd /usr/local 2.创建数据目录 # mkdir -pv