一区二区三区在线-一区二区三区亚洲视频-一区二区三区亚洲-一区二区三区午夜-一区二区三区四区在线视频-一区二区三区四区在线免费观看

服務(wù)器之家:專注于服務(wù)器技術(shù)及軟件下載分享
分類導(dǎo)航

Mysql|Sql Server|Oracle|Redis|MongoDB|PostgreSQL|Sqlite|DB2|mariadb|Access|數(shù)據(jù)庫(kù)技術(shù)|

服務(wù)器之家 - 數(shù)據(jù)庫(kù) - mariadb - Mac中MariaDB數(shù)據(jù)庫(kù)的安裝步驟

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

2020-06-04 16:05閃爍之狐 mariadb

大家都知道MariaDB數(shù)據(jù)庫(kù)管理系統(tǒng)是MySQL的一個(gè)分支,主要由開(kāi)源社區(qū)在維護(hù),采用GPL授權(quán)許可MariaDB的目的是完全兼容MySQL,包括API和命令行,使之能輕松成為MySQL的代替品。這篇文章我們將詳細(xì)介紹在Mac中安裝MariaDB數(shù)據(jù)庫(kù)的步驟,

前言

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

MariaDB安裝步驟

如果你是Mac上的開(kāi)發(fā)者,通過(guò)本文你可以在OS X上通過(guò)Homebrew來(lái)簡(jiǎn)單的獲取安裝最新穩(wěn)定版本的MariaDB,接下來(lái)我們將一步步的來(lái)指導(dǎo)安裝MariaDB數(shù)據(jù)庫(kù),如果你的Mac中已經(jīng)安裝好了Xcode和Homebrew的話,則直接跳到第四步。

1. 安裝Xcode

使用如下命令來(lái)安裝Xcode

?
1
xcode-select --install

2. 安裝Homebrew

安裝Homebrew的命令:

?
1
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"

3. 檢查Homebrew

?
1
brew doctor

4. 更新Homebrew

如果通過(guò)上面的命令檢查到Homebrew不是最新的版本,可以通過(guò)如下命令來(lái)把Homebrew更新到最新:

?
1
brew update

5. 確認(rèn)MariaDB的版本

Homebrew倉(cāng)庫(kù)中確認(rèn)MariaDB的版本:

?
1
brew info mariadb

6. 安裝MariaDB

通過(guò)如下命令來(lái)下載安裝MariaDB:

?
1
brew install mariadb

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

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

?
1
2
3
unset TMPDIR
cd /usr/local/Cellar/mariadb/10.0.10/
mysql_install_db

8. 運(yùn)行MariaDB

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

?
1
mysql.server start

9. 安全的完成安裝

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

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

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
? 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ù)庫(kù)的命令:

?
1
mysql -u root -p

11. 驗(yàn)證MariaDB版本

?
1
2
3
4
5
6
7
MariaDB [(none)]> select @@version;
+-----------------+
| @@version  |
+-----------------+
| 10.1.14-MariaDB |
+-----------------+
1 row in set (0.00 sec)

MariaDB基礎(chǔ)命令

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

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
-- 顯示數(shù)據(jù)庫(kù)列表
show databases;
 
-- 切換到名為mysql的數(shù)據(jù)庫(kù),顯示該庫(kù)中的數(shù)據(jù)表
use mysql;
show tables;
 
-- 顯示數(shù)據(jù)表table的結(jié)構(gòu)
desc table;
 
-- 建數(shù)據(jù)庫(kù)A與刪數(shù)據(jù)庫(kù)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ù)庫(kù)的全部步驟,大家都學(xué)會(huì)了嗎?希望這篇文章的內(nèi)容對(duì)大家的學(xué)習(xí)能有所幫助,如果有疑問(wèn)大家可以留言交流。

延伸 · 閱讀

精彩推薦
主站蜘蛛池模板: 日本不卡一区二区三区在线观看 | 激情影院网站 | 国模一区二区三区视频一 | 日本人泡妞xxxxxx69 | 非洲特级特黄aa大片 | 精品亚洲永久免费精品 | 国产福利片在线 | 久久re视频精品538在线 | 性欧美高清理论片 | 天天做天天爱天天爽综合区 | 欧美三级一区 | 国模孕妇季玥全部人体写真 | 国产久草在线 | 青青草国产免费久久久91 | 国产视频一区在线观看 | 国产第2页 | 好湿好紧太硬了我太爽了网站 | 国产一区二区视频在线 | 嗯啊在线观看免费影院 | 国产va欧美va在线观看 | 色淫阁小说 | 暖暖在线日本 | 日本一区二区视频免费播放 | 色五月天天 | 91寡妇天天综合久久影院 | 女主被当众调教虐np | 久久久精品成人免费看 | 亚州中文字幕 | 91制片厂制作传媒破解版免费 | 国产精品日韩欧美一区二区三区 | 国产乱人乱精一区二区视频密 | 99爱免费视频 | 精品国产成a人在线观看 | chinesezoozvideos| 国产毛片在线高清视频 | 九九免费高清在线观看视频 | 暖暖的免费观看高清视频韩国 | 韩国理论片最新第一页 | 日本视频在线免费播放 | 动漫美女被羞羞产奶 | 日韩国产欧美精品综合二区 |