美文网首页
安装mysql(Mac)

安装mysql(Mac)

作者: 4VZhang | 来源:发表于2017-11-10 16:36 被阅读26次

1.从官网下载dmg格式的安装包

官网下载安装包.png

2.双击下载的安装包,按‘‘继续’’/‘‘同意’’直到最后安装完成

继续.png 同意.png
安装.png 授权.png

3.为了方便使用,设置全局变量
打开终端(Terminal),
1)cd ~

2)如果没有 .bash_profile文件,会创建该文件
touch .bash_profile

3)打开并编辑.bash_profile文件
open .bash_profile 使用文本编辑器打开 .bash_profile文件
或者 vi .bash_profile 直接在终端界面编辑 .bash_profile文件

4).bash_profile文件中添加路径
export PATH=${PATH}:/usr/local/mysql-5.6.38-macos10.12-x86_64/bin
路径中 mysql-5.6.38-macos10.12-x86_64和下载的安装包的名称保持一致

mysql安装包.png
5) 保存并关闭.bash_profile文件
文本编辑器打开---保存(command+s) 关闭(command+w)
终端编辑的打开-------------输入:wq

6)更新刚配置的环境变量
source .bash_profile

4.启动mysql服务器
打开系统偏好设置——>Mysql——>Start Mysql Sever

mysql连接状态.png

5.登录
终端输入mysql -u root -p
会提示输入密码,如果没设置过密码就直接按enter略过;
当看到 Welcome to the MySQL monitor.xxxxxx字样,表示登录成功

相关文章

网友评论

      本文标题:安装mysql(Mac)

      本文链接:https://www.haomeiwen.com/subject/drhmmxtx.html