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修改连接器、用户名密码即可完成连接

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