在Macos上,使用homebrew下载并配置mysql

下载mysql

brew install mysql

启动mysql

注意:由于启动mysql的指令会先将在Github上的官方维护的tap克隆到homebrew-services文件夹中,因此需要先确定能够稳定地访问Github
如果很不幸你无法稳定的访问Github,我们可以更改homebrew主仓库的git远程地址和homebrew核心软件仓库的git远程地址

export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.aliyun.com/homebrew/brew.git"  
export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.aliyun.com/homebrew/homebrew-core.git"

接下来启动mysql

brew services start mysql

进入mysql

mysql -u root -p

如果要求输入密码的话,直接回车即可

修改mysql的root账户的密码

use mysql;
update user set authentication_string=password('你的密码') where user='root' and Host='localhost';

退出mysql

exit;

关闭mysql

brew services stop mysql
posted @ 2024-06-02 21:53  LanceEst  阅读(22)  评论(0编辑  收藏  举报