欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Mac中MariaDB數(shù)據(jù)庫的安裝步驟

 更新時間:2016年09月22日 10:31:41   作者:閃爍之狐  
大家都知道MariaDB數(shù)據(jù)庫管理系統(tǒng)是MySQL的一個分支,主要由開源社區(qū)在維護(hù),采用GPL授權(quán)許可MariaDB的目的是完全兼容MySQL,包括API和命令行,使之能輕松成為MySQL的代替品。這篇文章我們將詳細(xì)介紹在Mac中安裝MariaDB數(shù)據(jù)庫的步驟,有需要可以參考學(xué)習(xí)。

前言

MariaDB由MySQL的創(chuàng)始人Michael Widenius主導(dǎo)開發(fā),他早前曾以10億美元的價格,將自己創(chuàng)建的公司MySQL賣給了SUN,此后,隨著SUN被甲骨文收購,MySQL的所有權(quán)也落入Oracle的手中。MariaDB名稱來自Michael Widenius的女兒Maria的名字。那么在Mac中如何安裝MariaDB數(shù)據(jù)庫呢?下面小編就給大家介紹Mac中安裝配置MariaDB數(shù)據(jù)庫的方法。

MariaDB安裝步驟

如果你是Mac上的開發(fā)者,通過本文你可以在OS X上通過Homebrew來簡單的獲取安裝最新穩(wěn)定版本的MariaDB,接下來我們將一步步的來指導(dǎo)安裝MariaDB數(shù)據(jù)庫,如果你的Mac中已經(jīng)安裝好了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. 確認(rèn)MariaDB的版本

Homebrew倉庫中確認(rèn)MariaDB的版本:

brew info mariadb 

6. 安裝MariaDB

通過如下命令來下載安裝MariaDB:

brew install mariadb 

7. 運行數(shù)據(jù)庫安裝程序

分別執(zhí)行下面的命令來實現(xiàn)安裝:

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

8. 運行MariaDB

經(jīng)過了上面的若干命令,已經(jīng)安裝好了MariaDB數(shù)據(jù)庫,但是MariaDB數(shù)據(jù)庫服務(wù)并沒有啟動,你可以通過這個命令來啟動MariaDB數(shù)據(jù)庫服務(wù):

mysql.server start 

9. 安全的完成安裝

通過上面的啟動MariaDB數(shù)據(jù)庫服務(wù),你已經(jīng)可以連接MariaDB的數(shù)據(jù)庫了,但是還不夠安全,通過如下步驟可以完成更全面的設(shè)置,如:重設(shè)root用戶的密碼、移除匿名用戶、移除默認(rèn)的test數(shù)據(jù)庫等等

具體的執(zhí)行和設(shè)置如下:

➜ 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數(shù)據(jù)

連接MariaDB數(shù)據(jù)庫的命令:

mysql -u root -p 

11. 驗證MariaDB版本

MariaDB [(none)]> select @@version; 
+-----------------+
| @@version  |
+-----------------+
| 10.1.14-MariaDB |
+-----------------+
1 row in set (0.00 sec) 

MariaDB基礎(chǔ)命令

下面是MariaDB的一些基礎(chǔ)使用命令:

-- 顯示數(shù)據(jù)庫列表
show databases;

-- 切換到名為mysql的數(shù)據(jù)庫,顯示該庫中的數(shù)據(jù)表
use mysql; 
show tables;

-- 顯示數(shù)據(jù)表table的結(jié)構(gòu)
desc table;

-- 建數(shù)據(jù)庫A與刪數(shù)據(jù)庫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; 

總結(jié)

以上就是在Mac中安裝MariaDB數(shù)據(jù)庫的全部步驟,大家都學(xué)會了嗎?希望這篇文章的內(nèi)容對大家的學(xué)習(xí)能有所幫助,如果有疑問大家可以留言交流。

相關(guān)文章

  • MariaDB數(shù)據(jù)庫的外鍵約束實例詳解

    MariaDB數(shù)據(jù)庫的外鍵約束實例詳解

    約束保證了數(shù)據(jù)的完整性和一致性。下面這篇文章主要給大家介紹了關(guān)于MariaDB數(shù)據(jù)庫的外鍵約束的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),需要的朋友可以參考借鑒,下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2018-09-09
  • 淺談MySQL和mariadb區(qū)別

    淺談MySQL和mariadb區(qū)別

    MariaDB是MySQL源代碼的一個分支,在意識到Oracle會對MySQL許可做什么后分離了出來(MySQL先后被Sun、Oracle收購)。除了作為一個Mysql的“向下替代品”,MariaDB包括的一些新特性使它優(yōu)于MySQL。通過本篇文章給大家介紹MySQL和mariadb區(qū)別,需要的朋友可以參考下
    2015-09-09
  • Window7安裝MariaDB數(shù)據(jù)庫及系統(tǒng)初始化操作分析

    Window7安裝MariaDB數(shù)據(jù)庫及系統(tǒng)初始化操作分析

    這篇文章主要介紹了Window7安裝MariaDB數(shù)據(jù)庫及系統(tǒng)初始化操作,簡明扼要的分析了Windows7平臺上安裝mariadb數(shù)據(jù)庫的步驟、配置方法及相關(guān)注意事項,需要的朋友可以參考下
    2018-05-05
  • CentOS安裝和設(shè)置MariaDB的教程

    CentOS安裝和設(shè)置MariaDB的教程

    這篇文章主要介紹了CentOS安裝和設(shè)置MariaDB的教程的相關(guān)資料,需要的朋友可以參考下
    2015-09-09
  • mariadb的主從復(fù)制、主主復(fù)制、半同步復(fù)制配置詳解

    mariadb的主從復(fù)制、主主復(fù)制、半同步復(fù)制配置詳解

    這篇文章主要詳細(xì)介紹了mariadb的主從復(fù)制、主主復(fù)制、半同步復(fù)制的概念和方法,有需要的小伙伴可以參考下
    2016-11-11
  • 詳解Centos 使用YUM安裝MariaDB

    詳解Centos 使用YUM安裝MariaDB

    這篇文章主要介紹了詳解Centos 使用YUM安裝MariaDB的相關(guān)資料,需要的朋友可以參考下
    2015-09-09
  • MariaDB10.5.6的安裝與使用詳解

    MariaDB10.5.6的安裝與使用詳解

    這篇文章主要介紹了MariaDB10.5.6的安裝與使用詳解,本文給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下
    2020-11-11
  • 關(guān)于MariaDB安裝問題小記(CMake Error at)

    關(guān)于MariaDB安裝問題小記(CMake Error at)

    這篇文章主要介紹了今日在安裝MariaDB的時候始終提示如下錯誤,但是我已經(jīng)安裝了libaio-devel庫,需要的朋友可以參考下
    2014-12-12
  • 詳談MySQL和MariaDB區(qū)別與性能全面對比

    詳談MySQL和MariaDB區(qū)別與性能全面對比

    這篇文章主要介紹了詳談MySQL和MariaDB區(qū)別與性能全面對比,需要的朋友可以參考下
    2020-02-02
  • MariaDB的安裝與配置教程

    MariaDB的安裝與配置教程

    MariaDB是MySQL的一個分支,由開源社區(qū)維護(hù),采用GPL授權(quán)許可,完全兼容MySQL,這篇文章主要介紹了MariaDB的安裝與配置,需要的朋友可以參考下
    2022-06-06

最新評論