Mac中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使用如下命令来安装 2. 安装Homebrew安装 3. 检查Homebrew4. 更新Homebrew如果通过上面的命令检查到 5. 确认MariaDB的版本在 6. 安装MariaDB通过如下命令来下载安装MariaDB: 7. 运行数据库安装程序分别执行下面的命令来实现安装: 8. 运行MariaDB经过了上面的若干命令,已经安装好了MariaDB数据库,但是MariaDB数据库服务并没有启动,你可以通过这个命令来启动MariaDB数据库服务: 9. 安全的完成安装通过上面的启动MariaDB数据库服务,你已经可以连接MariaDB的数据库了,但是还不够安全,通过如下步骤可以完成更全面的设置,如:重设 具体的执行和设置如下: 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 Enter current password for root (enter for none): Setting the root password ensures that nobody can log into the MariaDB Set root password? [Y/n] Y By default,a MariaDB installation has an anonymous user,allowing anyone Remove anonymous users? [Y/n] Y Normally,root should only be allowed to connect from 'localhost'. This Disallow root login remotely? [Y/n] n By default,MariaDB comes with a database named 'test' that anyone can Remove test database and access to it? [Y/n] Y
Reloading the privilege tables will ensure that all changes made so far Reload privilege tables now? [Y/n] Y Cleaning up... All done! If you've completed all of the above steps,your MariaDB Thanks for using MariaDB! 10. 连接MariaDB数据连接MariaDB数据库的命令: 11. 验证MariaDB版本 select @@version;
+-----------------+
| @@version |
+-----------------+
| 10.1.14-MariaDB |
+-----------------+
1 row in set (0.00 sec)
MariaDB基础命令 下面是MariaDB的一些基础使用命令: -- 切换到名为mysql的数据库,显示该库中的数据表
use mysql; show tables; -- 显示数据表table的结构 -- 建数据库A与删数据库A -- 建表: -- 显示表中的记录: -- 清空表中记录: 总结 以上就是在Mac中安装MariaDB数据库的全部步骤,大家都学会了吗?希望这篇文章的内容对大家的学习能有所帮助,如果有疑问大家可以留言交流。 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |