0
点赞
收藏
分享

微信扫一扫

macOS安装MySQL,使用Navicat连接MySQL数据库/2022

Sikj_6590 2022-03-12 阅读 105

macOS安装MySQL,使用Navicat连接MySQL数据库/2022

intel chip

下载安装文件

进入官网

MySQL :: MySQL Downloads

选择页尾MySQL Community Server

https://pic-1259640338.cos.ap-shanghai.myqcloud.com/img/Screen%20Shot%202022-03-08%20at%2013.11.53.png

选择合适的版本,.tar.gz是压缩包,.dmg是可安装文件,随便下一个就行

https://pic-1259640338.cos.ap-shanghai.myqcloud.com/img/Screen%20Shot%202022-03-08%20at%2013.13.18.png

询问是否登陆,直接no thanks

https://pic-1259640338.cos.ap-shanghai.myqcloud.com/img/Screen%20Shot%202022-03-08%20at%2013.15.35.png

安装MySQL

双击dmg文件,点击pkg

一路allow 和 continue

此处选择 Use Strong Password Encryption

https://pic-1259640338.cos.ap-shanghai.myqcloud.com/img/Screen%20Shot%202022-03-08%20at%2013.21.07.png

给root用户设置一个密码

https://pic-1259640338.cos.ap-shanghai.myqcloud.com/img/Screen%20Shot%202022-03-08%20at%2013.23.06.png

至此安装完成

配置环境变量

终端键入echo $SHELL

https://pic-1259640338.cos.ap-shanghai.myqcloud.com/img/Screen%20Shot%202022-03-08%20at%2013.27.27.png

如果自己没做过修改的话,应该是/bin/bash,我之前修改过,所以是zsh

bash方式

终端键入

sudo vim ~/.bash_profile

https://pic-1259640338.cos.ap-shanghai.myqcloud.com/img/Screen%20Shot%202022-03-08%20at%2013.34.00.png

i进入编辑插入模式

https://pic-1259640338.cos.ap-shanghai.myqcloud.com/img/Screen%20Shot%202022-03-08%20at%2013.34.56.png

添加语句 PATH=$PATH:/usr/local/mysql/bin

https://pic-1259640338.cos.ap-shanghai.myqcloud.com/img/Screen%20Shot%202022-03-08%20at%2013.35.54.png

按一下Ese,然后输入:wq,屏幕下方会显示

https://pic-1259640338.cos.ap-shanghai.myqcloud.com/img/Screen%20Shot%202022-03-08%20at%2013.37.36.png

回车,则完成修改文件

终端输入:source ~/.bash_profile,重新执行此文件,即可

zsh方式

与bash基本类似,开头修改的文件则是.zshrc

sudo vim ~/.zshrc
i
添加:PATH=$PATH:/usr/local/mysql/bin
ese
:wq
回车
source ~/.zshrc

https://pic-1259640338.cos.ap-shanghai.myqcloud.com/img/Screen%20Shot%202022-03-08%20at%2013.45.50.png

至此mysql命令已被终端识别

登陆Mysql

终端键入mysql -uroot -p

提示输入密码,此处密码是安装的时候设置的密码

https://pic-1259640338.cos.ap-shanghai.myqcloud.com/img/Screen%20Shot%202022-03-08%20at%2013.50.01.png

使用Navicat连接MySql

https://pic-1259640338.cos.ap-shanghai.myqcloud.com/img/Screen%20Shot%202022-03-08%20at%2013.51.07.png

点击左上角Connection → MySQL

Connection Name中随便写个名字,下面的password中输入安装MySQL时候设置的密码

https://pic-1259640338.cos.ap-shanghai.myqcloud.com/img/Screen%20Shot%202022-03-08%20at%2013.52.44.png

在新建的Connection中右键,Open Connection

https://pic-1259640338.cos.ap-shanghai.myqcloud.com/img/Screen%20Shot%202022-03-08%20at%2013.53.20.png

能打开既成功

https://pic-1259640338.cos.ap-shanghai.myqcloud.com/img/Screen%20Shot%202022-03-08%20at%2013.54.48.png

举报

相关推荐

0 条评论