卸载:

brew remove mysqlbrew cleanuplaunchctl unload -w ~/Library/LaunchAgents/com.mysql.mysqld.plistrm ~/Library/LaunchAgents/com.mysql.mysqld.plistsudo rm -rf /usr/local/var/mysql
brew uninstall mysql@5.7
rm -rf /usr/local/var/mysql
rm /usr/local/etc/my.cnf--- 然后安装brew install mysql@5.7  // 安装
brew link --force mysql@5.7 // 链接
brew services start mysql@5.7 // 启动服务
echo 'export PATH="/usr/local/opt/mysql@5.7/bin:$PATH"' >> ~/.zshrc // 输出到环境变量

安装:

搜索一下mysql版本:

brew search mysql
==> Formulae
automysqlbackup       mysql-cluster         mysql-search-replace  mysql@5.7
mysql                 mysql-connector-c     mysql-utilities       mysqltuner
mysql++               mysql-connector-c++   mysql@5.5
mysql-client          mysql-sandbox         mysql@5.6==> Casks
homebrew/cask/mysql-connector-python         homebrew/cask/navicat-for-mysql
homebrew/cask/mysql-shell                    homebrew/cask/sqlpro-for-mysql
homebrew/cask/mysql-utilities

安装mysql:

 brew install mysql@5.7ln -sfv /usr/local/opt/mysql@5.7/*.plist ~/Library/LaunchAgents

启动mysql服务

$ mysql.server start

继续执行mysql_secure_installation

cometdeMacBook-Pro:~ comet
$ mysql_secure_installation
 
Securing the MySQL server deployment.
 
Connecting to MySQL using a blank password.
 
VALIDATE PASSWORD PLUGIN can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD plugin?
 
Press y|Y for Yes, any other key for No: N   // 这个选yes的话密码长度就必须要设置为8位以上,但我只想要6位的
Please set the password for root here.
 
New password:            // 设置密码
 
Re-enter new password:     // 再一次确认密码
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.
 
Remove anonymous users? (Press y|Y for Yes, any other key for No) : Y    // 移除不用密码的那个账户
Success.
 
 
Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.
 
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : n
 
 ... skipping.
By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.
 
 
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
 - Dropping test database...
Success.
 
 - Removing privileges on test database...
Success.
 
Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.
 
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Success.
 
All done!

修改root密码

以前修改mysql密码字段是Password这个字段,但是mysql5.7没有这个字段而是使用了authentication_string替代

如果操作过程中报下面的错误

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

那么使用首先关闭mysql服务,然后以安全模式启动
mysql.server start --skip-grant-tables

  1. use mysql

  2. update user set authentication_string = password('root') where User='root';

  3. Query OK, 1 row affected, 1 warning (0.00 sec)

  4. Rows matched: 1 Changed: 1 Warnings: 1

  5. mysql> flush privileges;

  6. Query OK, 0 rows affected (0.00 sec)

最后可以参考:

https://blog.csdn.net/cheng649090216/article/details/79246333

https://blog.csdn.net/Bobdragery/article/details/90068643

https://blog.csdn.net/cheng649090216/article/details/79246333

https://www.jianshu.com/p/12e885cb6e33

Mac下Brew 卸载MySql以及安装Mysql 阿星小栈相关推荐

  1. centos6.5卸载和安装mysql_Linux CentOS 6.5 卸载、tar安装MySQL的教程

    卸载系统自带MySQL 1. 查看系统当前是否安装有MySQL rpm -qa|grep -i mysql 2. 卸载当前版本的MySQL yum remove mysql mysql-server ...

  2. tar安装卸载 mysql_Linux CentOS 6.5 卸载、tar安装MySQL的教程

    卸载系统自带mysql 1. 查看系统当前是否安装有mysql rpm -qa|grep -i mysql 2. 卸载当前版本的mysql yum remove mysql mysql-server ...

  3. 关于mac下搭建php、apache、mysql环境

    关于mac下搭建php.apache.mysql环境 装置 Mac预装的有Apache和PHP,我们可以直接使用.但是需要自己下载Mysql. Apache 首先,让我们来看一下是怎么开启Apache ...

  4. Linux下yum安装MySQL yum安装MySQL指定版本

    yum 安装MySQL 1. 检查安装情况 查看有没有安装过: yum list installed MySQL* (有存在要卸载yum remove MySQL*) rpm -qa | grep m ...

  5. 在PK体系下的CentOS上编译安装 MySQL 5.7

    本文主要介绍如何在 PK 体系下的 CentOS 上编译安装 MySQL 5.7,本文使用的操作系统环境为: CentOS 版本: # cat /etc/redhat-release CentOS L ...

  6. ubuntu下使用apt安装mysql_Ubuntu下通过apt包管理安装mysql

    949 首页 > 资讯 > Ubuntu下通过apt包管理安装mysql Ubuntu下通过apt包管理安装mysql 消息来源:http://forum.ubuntu.org.cn/vi ...

  7. mvn Mac Linux 版本,Mac 下 Maven 的命令行安装

    JDK 的安装 系统的"系统偏好设置"中我们可以看到 Java的设置, Java 7(含) 之后的版本在这里可以看到. 点击进去后,可以看到独立的 Java 控制面板 注意,这里是 ...

  8. linux 安装mysql make_Linux安装mysql——源码安装

    1.假设已经有mysql-5.5.10.tar.gz以及cmake-2.8.4.tar.gz两个源文件 (1)先安装cmake(mysql5.5以后是通过cmake来编译的) [root@ rhel5 ...

  9. Windows下静默卸载与静默安装

    Windows下静默卸载与静默安装 作者:高玉涵 时间:2020.12.27 15:09 博客:blog.csdn.net/cg_i 作者背景环境参见: <通过Windows批处理脚本批量修改D ...

  10. Mac卸载mysql并安装mysql升级到8.0.13版本

    引言 今天mysql升级到8.0.13版本,遇到了很多问题,在此进行总结方便以后查看. 卸载mysql brew uninstall mysql sudo rm /usr/local/mysql su ...

最新文章

  1. 4.1.1 网络层功能概述
  2. 时间更新服务器推荐 - NTP时间同步服务器集群:ntp.api.bz
  3. Makefile之自动生成依赖(8)
  4. CompactExifLib:访问JPEG文件中的EXIF标签
  5. CCF 2018-9-2买菜
  6. 数据库报12516linux,ORA-12516故障解决
  7. 2018青岛ICPC ZOJ 4063: Tournament(构造)
  8. Java线程的5种状态及切换(透彻讲解)-京东面试
  9. Java中的JDK动态代理
  10. c语言五行星型图案,五行图非五方星形图
  11. Linux文件帮助_重定向_vi
  12. Win32汇编:数组与标志位测试总结
  13. ie浏览器开发比谷歌浏览器_跨浏览器开发:处理IE
  14. 【天光学术】学前教育论文:幼儿园区角活动中存在的问题及有效对策(节选)
  15. PSP游戏开放环境的建立
  16. 工程材料学习2——第一章 材料的结构与性能特点
  17. Mac 从命令行启动模拟器
  18. LoRa节点如何以ABP方式入网TTN服务器?
  19. 基于盲估计和ICA的单通道盲分离算法–Matlab仿真
  20. SQL难学吗,有什么好的学习建议?(转载)

热门文章

  1. 小尺寸 GPS 北斗 GNSS 全向内置天线方案 CA-G01 CrossAir贴片天线
  2. 【微服务】Nacos注册中心
  3. 谈谈Oracle甲骨文可视化文件查看器:AutoVue
  4. 11.Python初窥门径(函数名,可迭代对象,迭代器)
  5. 「hdu6638」Snowy Smile【稀疏矩阵最大子矩阵和】
  6. 怎么让计算机文件格式显示,已知文件类型的扩展名如何设置显示与隐藏?
  7. xamp环境搭建Pikachu实验环境搭建
  8. 腕管综合征(鼠标手)的康复之路
  9. html鼠标经过状态,HTML5 - 让Canvas内部元素实现鼠标移入、移出效果(Tooltip提示效果)...
  10. 干货分享|如何使用小鸟云服务器搭建Wordpress站点