MAC 安装mysql

用Homebrew进行安装

1
brew install mysql@5.7

  对mysql进行初始化

1)环境变量配置

vim ~/.bash_profile

添加以下指令:

export PATH=${PATH}:/user/local/Cellar/mysql@5.7/5.7.26/bin

生效

source ~/.bash_profile

2)启动服务

mysql.server start

3)初始化操作

mysql_secure_installation

  • Press y|Y for yes, any other key for NO:  【N】,如果选择Y,则需要输入8位密码
  • New password:  设置你的密码
  • Re-enter new password:  再次输入密码
  • Remove anontmous users?  【Y】是否移除不用密码的那个账户
  • Disallow root login remotely?   【N】是否禁止远程登录
  • Remove test database and access to it?   【Y】 是否删除test库
  • Reload privilege tables now?   【Y】是否重新加载

4)进入数据库

mysql -u root -p

5)数据库服务

启动:brew services start mysql@5.7

停止:brew services stop mysql@5.7

posted @   黒貓  阅读(419)  评论(0编辑  收藏  举报
编辑推荐:
· 智能桌面机器人:用.NET IoT库控制舵机并多方法播放表情
· Linux glibc自带哈希表的用例及性能测试
· 深入理解 Mybatis 分库分表执行原理
· 如何打造一个高并发系统?
· .NET Core GC压缩(compact_phase)底层原理浅谈
阅读排行:
· 开发者新选择:用DeepSeek实现Cursor级智能编程的免费方案
· Tinyfox 发生重大改版
· 独立开发经验谈:如何通过 Docker 让潜在客户快速体验你的系统
· 小米CR6606,CR6608,CR6609 启用SSH和刷入OpenWRT 23.05.5
· 近期最值得关注的AI技术报告与Agent综述!
点击右上角即可分享
微信分享提示