问题描述:使用brew方式安装mysql,存在以下问题:1.由于mysql已经升级到8.x版本,会默认安装8.x版本,会对之前部分特性不友好支持;2.brew默认安装源下载响应时间非常慢,下载时间过长容易超时;

问题解决:问题一通过brew search mysql可以查看到是有历史版本可以下载的包括经典的5.7版本;

问题二需要更换brew源地址,具体更换源地址如下:

问题延伸:网上搜索大家都说跳转到/usr/local目录下使用git remote操作,结果如下:

$ git remote -v

fatal: Not a git repository (or any of the parent directories): .git

这就很无语了,后来终于找到另一种姿势(使用环境变量去找);

替换以下几个镜像源:

替换为中科大的镜像:

替换brew.git:

cd "$(brew --repo)"

git remote set-url origin https://mirrors.ustc.edu.cn/brew.git

替换homebrew-core.git:

cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"

git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git

替换成功后更新下源:

brew update

对于bash用户:

echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile

source ~/.bash_profile

对于zsh用户:

echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.zshrc

source ~/.zshrc

也可以选择替换清华大学镜像(和上边部分效果相同):

替换brew.git:

cd "$(brew --repo)"

git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git

替换homebrew-core.git:

cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"

git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git

brew update

使用homebrew-science或者homebrew-python还需要替换

cd "$(brew --repo)/Library/Taps/homebrew/homebrew-science"

git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-science.git

cd "$(brew --repo)/Library/Taps/homebrew/homebrew-python"

git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-python.git

brew update

对于bash用户:

echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.bash_profile

source ~/.bash_profile

对于zsh用户:

echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.zshrc

source ~/.zshrc

替换好brew源地址安装mysql@5.7就会轻松很多;

brew源配置生效后使用brew install mysql@5.7安装即可;

安装完成后提示如下:

We've installed your MySQL database without a root password. To secure it run:

mysql_secure_installation #初始化配置

MySQL is configured to only allow connections from localhost by default

To connect run:

mysql -uroot #运行连接

mysql@5.7 is keg-only, which means it was not symlinked into /usr/local,

because this is an alternate version of another formula.

If you need to have mysql@5.7 first in your PATH run: #配置环境变量

echo 'export PATH="/usr/local/opt/mysql@5.7/bin:$PATH"' >> ~/.bash_profile

For compilers to find mysql@5.7 you may need to set:

export LDFLAGS="-L/usr/local/opt/mysql@5.7/lib" #想要系统编译运行认识mysql@5.7配置环境变量

export CPPFLAGS="-I/usr/local/opt/mysql@5.7/include"

To have launchd start mysql@5.7 now and restart at login:

brew services start mysql@5.7 #启动安装后的mysql数据库

Or, if you don't want/need a background service you can just run:

/usr/local/opt/mysql@5.7/bin/mysql.server start #通过配置文件启动mysql数据库

根据安装后提示信息第一步配置环境变量:

家目录下,vi .bashprofile文件,将安装后提示的:

export PATH="/usr/local/opt/mysql@5.7/bin:$PATH"

export LDFLAGS="-L/usr/local/opt/mysql@5.7/lib"

export CPPFLAGS="-I/usr/local/opt/mysql@5.7/include"

加入到.bash_profile文件中,加入保存后使用source .bashprofile使配置到环境变量生效;

完成后使用:brew services start mysql@5.7或者你根据配置文件启动mysql数据库,服务启动后开始初始化配置;

运行: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: k //是否采用mysql密码安全检测插件,我本地使用果断拒绝了,因为密码检查插件要求密码复杂程度高,大小写字母+数字+字符等

Please set the password for root here. // 首次使用自带配置脚本,设置root密码

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) : y //是否禁止远程登录

Success.

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!

配置完成,使用mysql -uroot -p,然后输入配置到root密码登陆到mysql数据库;

brew 安装 mysql5.7_Mac——brew替换源地址安装配置mysql@5.7版本相关推荐

  1. docker安装Mysql5.7以及远程登陆链接配置

    1.安装mysql5.7 docker镜像 docker安装:docker安装一条龙 1.拉取官方mysql5.7镜像 docker pull mysql:5.7 root@VM-12-5-ubunt ...

  2. rpm方式安装mysql5.7.24_linux centOS 7安装mysql 5.7.24

    前言 请务必先把整篇文章通读一遍,特别是后面的问题列表,以致于在安装过程中出现问题后不会心惊胆颤. 0.在安装mysql之前,查看是否已安装,及其删除方式 rpm -qa|grep mysql #查看 ...

  3. 二进制安装mysql5.6_轻松使用二进制安装Mysql5.6

    二进制安装mysql5.6 系统环境:Centos6.5 x86_64 mysql二进制包:mysql-5.6.29-linux-glibc2.5-x86_64.tar.gz #解压tar包到指定安装 ...

  4. centos 安装mysql5.7.19_centos7源码安装mysql5.7.19

    centos7源码包安装mysql5.7 5.7.20安装方法和5.7.19的一样. 1.安装前准备 清空环境.安装相应的软件包 1>关闭防火墙和SELinux 2>配置yum源(阿里云, ...

  5. linux安装 mysql-5.7.25_Linux 系统下安装 mysql5.7.25(glibc版)

    前言:经过一天半的折腾,终于把 mysql 5.7.25 版本安装上了 Amazon Linux AMI release 2017.09系统上,把能参考的博客几乎都看了一遍,终于发现这些细节问题,然而 ...

  6. suse 安装mysql5.6_SuSE11安装MySQL5.6.40:RPM安装方式

    摘要:SuSE11sp3 64位操作系统. MySQL5.6.40rpm安装包 注:kingtry是我的主机名 一.环境准备 操作系统:SuSE版本11sp3,64位kingtry:~ # uname ...

  7. centos 安装mysql5.7_Zabbix 4.2.5 安装部署实践详解

    [导读]云计算背景下,无论是大数据.物联网还是边缘计算,规模化后大量的设备需要保证正常运行,在人员一定的情况下,就需要提高运行维护效率.同时随着智能化被应用在人们生活的方方面面,关联性也越来越紧密,即 ...

  8. linux安装mysql5.7.25教程,Linux安装mysql-5.7.25

    安装环境介绍 1. 系统 Ubuntu18.0.4 2. mysql 版本 5.7.25 3. 安装方式 :二进制文件解压安装 4. 安装依赖libaio [官方文档](https://dev.mys ...

  9. centos安装mysql5.7.19_Linux下Centos7安装Mysql5.7.19的详细教程

    1.下载mysql 2.选择源码包,通用版点击下载 直接下载就可以了,不用登录 3.解压编译 tar -zxvf mysql-5.7.19.tar.gz cd mysql-5.7.19.tar.gz ...

最新文章

  1. SAP PP为工单创建好HU之后,如何查询HU号码?
  2. [PLAYING QTP] Part2—Record
  3. 【驱动】使用结构体 file_operations封装驱动设备的操作 | 结构体初始化
  4. 如何在SQL Server查询语句(Select)中检索存储过程(Store Procedure)的结果集
  5. 面向对象-多态的实现
  6. java线程归并排序_Java-归并排序 - FeanLau的个人空间 - OSCHINA - 中文开源技术交流社区...
  7. LeetCode2:Add Two Numbers
  8. Storm教程3编程接口
  9. 机器学习数据集哪里找:最佳数据集来源盘点
  10. [THINKING IN JAVA]访问权限控制
  11. 有望年底登场!小米12系列即将备案:骁龙895+2亿像素!
  12. 《南溪的目标检测学习笔记》——neck组件的设计笔记
  13. alembic生成数据库升级脚本
  14. 裴礼文数学分析中的典型问题与方法第3章一元微分学练习
  15. 解析:WMS仓库管理系统是什么,可以提供什么协助
  16. 树莓派小车C语言循迹,自动循迹小车_单片机/STM32/树莓派/Arduino/开发板创意项目-聚丰项目-电子发烧友网...
  17. 从零开始学习CANoe 系列文章目录汇总
  18. ROS学习(一)Ros 中使用kinect
  19. 沁恒三模键盘方案测试体验
  20. SDN开源框架:蝇量级选手Dragonflow究竟解决了什么问题

热门文章

  1. MVC常见的控制器,接口,数据层之间的操作
  2. 【从零之三(更)】自定义类中调用讯飞语音包错误解决办法
  3. 重新理解javascript回调函数
  4. 3389爆破DUBrute_2.1
  5. 背后的故事之 - 快乐的Lambda表达式(二)
  6. matlab的算法java_matlab环境下的回归算法分析
  7. js对象数组 按对象的某一属性进行去重
  8. Android char数据类型乱码��解决方法
  9. MySQL 表一列逗号分隔字段,按逗号切割
  10. sqlserver 2008安装总是弹出重启提示