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

问题描述:使用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数据库;

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/426585.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

ftp的本地用户搭建

前期的准备跟虚拟用户一样,就是配置文件不一样 修改配置文件 就是共享的都是自己的账号的家目录,然后启动服务就可以了 本地登陆的都是自己的账号密码 ftp本地的黑名单, 转载于:https://www.cnblogs.com/cash-su/p/9824553.html

java学习(42):巩固练习

定义一个testjava类 /*4 编写一个TestStudentOverrideConstructor.java类, 包含main方法,从控制台接收用户输入的学生信息,包括学生姓名,性别和年龄,使用带参数的构造器创建学生对象并将接收到的输入传递给这个构造器参…

错误解决:常出现在iis搭建网站

不能在此路径中使用此配置节。如果在父级别上锁定了该节,便会出现这种情况。锁定 在全新安装的IIS7下搭建网站,访问页面时出现错误信息如下: 配置错误 不能在此路径中使用此配置节。如果在父级别上锁定了该节,便会出现这种情况。锁定是默认…

java收发邮寄_JavaMail收发邮件的一般流程与主要方法

1、Properties属性类Properties p new Properties();p.put(key, value);key-| mail.smtp.host-| mail.smtp.port-| mail.smtp.auth->"true":"false"2、生成Authenticator的子类Overrideprotected PasswordAuthenticationgetPasswordAuthentication(){r…

Java中TreeMap和TreeSet的底层实现

TreeSet底层则采用NavigableMap这个接口来保存TreeSet集合&#xff0c;而实际上NavigableMap只是一个接口&#xff0c;实际上TreeSet还是用TreeMap来保存set元素。 TreeSet初始化的时候会new 一个TreeMap进行初始化&#xff1b; private transient NavigableMap<E,Object>…

oracle 11g数据库数据操作(亲测)

oracle 11g安装和oracle数据库监听配置就不说了&#xff0c;直接说数据库的相关操作 建立 wiicare 用户 create directory dump_dir as ‘d:\test\dump’; 使用 PLSQL Developer 连接数据库 登陆数据库&#xff0c;用户名:system 密码: 123456 连接为&#xff1a;sysdba 新建表…

使用mybatis操作AS400数据库

先简单说一下怎么使用【jt400.jar】连接AS400上的DB2数据库。 ※ jt400.jar资源&#xff0c;如果有安装AS400客户端的话&#xff0c;参考IBM官网 ※ http://www-01.ibm.com/support/docview.wss?uidswg21398042 安装目录下就有jt400.zip&#xff0c;改个后缀就能用了。 如果没…

java ajax 获取headers_Ajax获取Response头信息

$.ajax({type: HEAD, // 获取头信息&#xff0c;typeHEAD即可url : window.location.href,complete: function( xhr,data ){// 获取相关Http Response headervar wpoInfo {// 服务器端时间"date" : xhr.getResponseHeader(Date),// 如果开启了gzip&#xff0c;会返回…

oracle 数据操作的相关参数

ATTACH 连接到现有作业。 例如, ATTACHjob_name。 CONTENT 指定要加载的数据。 有效的关键字为: [ALL], DATA_ONLY 和 METADATA_ONLY。 DATA_OPTIONS 数据层选项标记。 有效的关键字为: SKIP_CONSTRAINT_ERRORS。 DIRECTORY 用于转储文件, 日志文件和 SQL 文件的目录对象。 …

【论文阅读】Deep Adversarial Subspace Clustering

导读&#xff1a; 本文为CVPR2018论文《Deep Adversarial Subspace Clustering》的阅读总结。目的是做聚类&#xff0c;方法是DASCDSC&#xff08;Deep Subspace Clustering&#xff09;GAN&#xff08;Generative Adversarial Networks&#xff09;。本文从以下四个方面来对论…

java 数据库连接池 开源_开源自己开发的一个JAVA数据库连接池,效果还算可以。...

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼}public PreparedStatement prepareStatement(String sql, int[] columnIndexes)throws SQLException {return c.prepareStatement(sql, columnIndexes);}public PreparedStatement prepareStatement(String sql, String[] columnN…

Oracle数据库配置监听的作用

监听的作用就是给客户端电脑和中心数据库电脑建立数据的连接。一旦建立连接就不对两者造成任何影响&#xff0c;连接上的客户端上的用户可以做任何操作和查询&#xff0c;哪怕监听已经关闭或者被破坏。 注意&#xff1a;在数据库本机电脑连接数据库不需要用监听。哪怕没有监听…

java 值相同 hashcode_搞懂 Java equals 和 hashCode 方法

image搞懂 Java equals 和 hashCode 方法分析完 Java List 容器的源码后&#xff0c;本来想直接进入 Set 和 Map 容器的源码分析&#xff0c;但是对于这两种容器&#xff0c;内部存储元素的方式的都是以键值对相关的&#xff0c;而元素如何存放&#xff0c;便与 equals 和 hash…

Hadoop学习笔记

1.Hadoop安装 Apache的国内镜像地址&#xff1a; 地址1&#xff1a;http://mirror.bit.edu.cn/apache/ 地址2&#xff1a;https://mirrors.tuna.tsinghua.edu.cn/apache Fuck CSDN&#xff0c;谁给你的权利把开源的东西作为商品&#xff08;下载积分&#xff09;售卖&#xff1…

玩转oracle 11g(1):Oracle 11g的安装

由于工作需要&#xff0c;本人现在要对oracle 11g做一段攻坚战&#xff0c;先从安装开始 基本是傻瓜程序&#xff0c;网上也有大量教程 1 安装数据库软件 安装前准备工作 a.必须使用超级用户安装&#xff08;adminstrator&#xff09; b.服务器的名称不要有汉字 c.服务器的名称…

WEB基本架构

转载于:https://www.cnblogs.com/JerryZao/p/9843804.html

怎样创建两个菜单JAVA_java – 如何创建一个菜单的JButton?

这在Swing比在需要是更困难的方式。因此&#xff0c;我不是指向你的教程&#xff0c;我创建了一个完全工作的例子。import javax.swing.*;import java.awt.*;import java.awt.event.ActionEvent;import java.awt.event.MouseAdapter;import java.awt.event.MouseEvent;public c…

玩转oracle 11g(2):创建数据库

纯属个人操作&#xff0c;不懂私聊我 在程序列表中 oracle 的文件下&#xff0c;找到 database configuration assistant 下一步 继续下一步 定制数据库 命名测试歌谣 取消勾选&#xff0c;下一步 为所有用户设置密码 geyao 下一步 点击编辑归档参数 档案资料库取消勾…

Selenium 自动化测试基础知识

1. 适合做自动化测试的项目 需求变更更有计划性&#xff0c;并且频率不高&#xff1b;项目周期长&#xff0c;资源丰富评估重复使用自动化测试脚本的过程、时间&#xff1b;项目测试过程中&#xff0c;回归测试轮次比较多&#xff0c;功能点多&#xff0c;时间比较短&#xff1…

玩转oracle 11g(3):配置监听

1打开oracle net configuration 2下一步 3服务名歌谣 4下一步 5主机名电脑的 6测试 输入账号密码总会把&#xff0c;不多说