亚洲精品久久久中文字幕-亚洲精品久久片久久-亚洲精品久久青草-亚洲精品久久婷婷爱久久婷婷-亚洲精品久久午夜香蕉

您的位置:首頁技術文章
文章詳情頁

Mac中MariaDB數據庫的安裝步驟

瀏覽:100日期:2023-03-30 13:21:17

前言

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數據庫的全部步驟,大家都學會了嗎?希望這篇文章的內容對大家的學習能有所幫助,如果有疑問大家可以留言交流。

標簽: MariaDB
相關文章:
主站蜘蛛池模板: 免费高清毛片 | 国内国语一级毛片在线视频 | 一级片在线观看 | 91视在线国内在线播放酒店 | 亚洲国产毛片aaaaa无费看 | 欧美三级成版人版在线观看 | 日韩成人在线观看视频 | 久久国产精品超级碰碰热 | 日韩精品久久不卡中文字幕 | 亚州三级视频 | 免费视频片在线观看大片 | 精精国产xxxx视频在线播放器 | 久久久99精品久久久久久 | 国内久久久久影院精品 | 亚洲欧美一区二区三区蜜芽 | 精品在线免费观看视频 | 亚洲精品中文字幕乱码影院 | 麻豆国产精品va在线观看不卡 | 久久色婷婷 | 欧美精品国产综合久久 | 九九夜夜| 久久有这有精品在线观看 | 日韩一页| 亚洲欧美在线中文字幕不卡 | 一区二区视频免费观看 | 日韩在线操 | 一级毛片成人午夜 | 91porn在线观看国产 | 欧美一级二级毛片视频 | 一区二区不卡视频 | 国产精品成人va在线观看入口 | 国产精品视频一区麻豆 | 日韩中文字幕在线 | 国产成人免费观看 | 亚洲一片 | 2015日韩永久免费视频播放 | 一级做a爰片久久毛片人呢 一级做a爰片久久毛片毛片 | 国产精品第2页 | 欧美高清v| 中文字幕一区在线观看视频 | 一级做α爱过程免费视频 |