mac下配置mysql
一、Mac OS X上彻底卸载mysql
注:如果之前安装过mysql,需要执行以下步骤,将之前的mysql全部卸载
- 打开终端窗口
- 使用mysqldump备份你的数据库将文本文件!
- 停止数据库服务器
sudo rm /usr/local/mysql
sudo rm -rf /usr/local/mysql*
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/My*
edit /etc/hostconfig and remove the line MYSQLCOM=-YES-
rm -rf ~/Library/PreferencePanes/My*
sudo rm -rf /Library/Receipts/mysql*
sudo rm -rf /Library/Receipts/mysql*
sudo rm -rf /private/var/db/receipts/mysql
参考链接:https://www.jianshu.com/p/fba...
二、安装mysql
- 先下载mysql(推荐5.7):https://dev.mysql.com/downloa...
- 一路默认安装,最后弹窗会给mqsql默认密码,记得保存
三、连接mysql
vim ~/.bash_profile
,进入编辑模式,将PATH="$PATH":/usr/local/mysql/bin
拷贝到里面。保存退出source ~/.bash_profile
echo $PATH
- 如果安装了oh my zsh的话,执行
vim ~/.zshrc
输入export PATH=${PATH}:/usr/local/mysql/bin
保存退出 source ~/.zshrc
mysql -u root -p
, 密码为默认密码
四、修改密码
- mysql >
set PASSWORD =PASSWORD('123456');
// 例如密码为123456 - 重新登录mysql就生效了
五、重启mysql
办法1
- 可以在系统偏好设置里开启和关闭mysql服务
办法2
- 启动MySQL服务
sudo /usr/local/MySQL/support-files/mysql.server start
- 停止MySQL服务
sudo /usr/local/mysql/support-files/mysql.server stop
- 重启MySQL服务
sudo /usr/local/mysql/support-files/mysql.server restart
连接Sequel Pro
1.连接本地mysql
- file -> New Connection Tab
- 填写信息例如:连接本地mysql
- 点击connect进入管理界面
相关推荐
乌冬面 2020-06-21
changecan 2020-11-19
sunnnyduan 2020-10-16
lonesomer 2020-09-17
houdaiye 2020-09-23
XPZ0 2020-09-22
changecan 2020-09-22
jackadmi 2020-09-11
yuan00yu 2020-08-24
yserver 2020-08-15
liyansring 2020-08-15
liai 2020-08-09
山有木兮卿有意 2020-08-03
85206633 2020-07-28
suosuo 2020-07-28
83911930 2020-07-28
85590296 2020-07-22