4部搞定 MacOS 下載MySQL及可視化 【無效直播倒立洗頭】

前提

剛剛完成《python入門語法》和《人工智能入門》課程的製作 (有興趣請私聊博主,商業課程,但找我有折扣》 ,下面即將開始《Python數據分析》的課程
在課程製作的過程中發現,無論是CSV還是Excel,甚至是XML等等對於數據存儲都不是長久之計,而主流的數據庫和訓練集基本上都有SQL版本,因此補充SQL課程迫在眉睫。

但是由於國內網絡擁堵,在MacOS系統下完成mysql的安裝和可視化一直都讓人惱火,下面出一個全套流程以供大家參考

步驟一,brew下載

終端輸入代碼,直接進行傻瓜腳本brew安裝

/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"

在這裏插入圖片描述

按照提示選擇即可

步驟二,mysql安裝

終端輸入指令安裝mysql,第一步的腳本自動設置了快速下載的源

brew install mysql

別斷網,就肯定沒問題🤷‍♂️

步驟三,mysql配置

安裝好 MySQL 後,需要進行初始化配置,先熟悉一下 啓動和停止 MySQL 的方法:
啓動:brew services staert mysql
重啓:brew services restaert mysql
停止:brew services stop mysql
查看版本:brew info mysql
注:所有通過 brew 安裝的軟件,都可以使用以上4條命令進行操作和查看

在終端輸入指令

brew services staert mysql

啓動了 MySQL 後,在sql的指令臺輸入mysql_secure_installation進行初始化

mysql_secure_installation

給出我的配置參考

cometdeMacBook-Pro:~ comet$ mysql_secure_installation

Securing the MySQL server deployment.

Connecting to MySQL using a blank password.

VALIDATE PASSWORD PLUGIN can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD plugin?

Press y|Y for Yes, any other key for No: N   // 這個選yes的話密碼長度就必須要設置爲8位以上,但我只想要6位的
Please set the password for root here.

New password:             // 設置密碼

Re-enter new password:     // 再一次確認密碼
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL 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? (Press y|Y for Yes, any other key for No) : 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? (Press y|Y for Yes, any other key for No) : n  //不接受root遠程登錄賬號

 ... skipping.
By default, MySQL 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? (Press y|Y for Yes, any other key for No) : y  //刪除text數據庫
 - 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? (Press y|Y for Yes, any other key for No) : y
Success.    // 立即重新加載權限表

All done!

步驟四,安裝可視化

下載workbench並完成配置即可,提供64位下載地址,複製即下載,拖拽後直接可以使用https://cdn.mysql.com//Downloads/MySQLGUITools/mysql-workbench-community-8.0.19-macos-x86_64.dmg

打開workbench,我這裏改了名字叫做TESTDB,默認的應該是localhostdb:
在這裏插入圖片描述
點擊設置打開頁面
在這裏插入圖片描述
完畢後,點擊關閉【設置頁面】,雙節TESTDB按鈕,進入數據庫編輯頁面。
在這裏插入圖片描述
至此,完成全部安裝。在Django當中的setting修改連接器、用戶名密碼即可完成連接

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章