Mac下使用Homebrew安装MySQL5.7

Mac下使用Homebrew安装MySQL5.7

  • 1. 安装Homebrew & Oh-My-Zsh
  • 2. 查询软件信息
  • 3. 执行安装命令
  • 4. 开机启动
  • 5. 服务状态查询
  • 6. 初始化配置
  • 7. 登录测试
    • 7.1 终端登录
    • 7.2 客户端登录
  • 参考

在这里插入图片描述

1. 安装Homebrew & Oh-My-Zsh

mac下如何安装homebrew
MacOS安装Homebrew与Oh-My-Zsh

2. 查询软件信息

% brew search mysql==> Formulae
automysqlbackup       mysql                 mysql++               mysql-client          mysql-client@5.7      mysql-connector-c++   mysql-sandbox         mysql-search-replace  mysql@5.6             mysql@5.7             mysqltuner            qt-mysql==> Casks
mysql-connector-python                                mysql-shell                                           mysqlworkbench                                        navicat-for-mysql                                     sqlpro-for-mysql

3. 执行安装命令

% brew install mysql@5.7
==> Fetching dependencies for mysql@5.7: ca-certificates, openssl@3, libevent, lz4, openssl@1.1, abseil, jsoncpp and protobuf==> Installing dependencies for mysql@5.7: ca-certificates, openssl@3, libevent, lz4, openssl@1.1, abseil, jsoncpp and protobufWe've installed your MySQL database without a root password. To secure it run:mysql_secure_installationMySQL is configured to only allow connections from localhost by defaultTo connect run:mysql -urootmysql@5.7 is keg-only, which means it was not symlinked into /opt/homebrew,
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="/opt/homebrew/opt/mysql@5.7/bin:$PATH"' >> ~/.zshrcFor compilers to find mysql@5.7 you may need to set:export LDFLAGS="-L/opt/homebrew/opt/mysql@5.7/lib"export CPPFLAGS="-I/opt/homebrew/opt/mysql@5.7/include"To start mysql@5.7 now and restart at login:brew services start mysql@5.7
Or, if you don't want/need a background service you can just run:/opt/homebrew/opt/mysql@5.7/bin/mysqld_safe --datadir\=/opt/homebrew/var/mysql

4. 开机启动

% brew services start mysql@5.7
==> Successfully started `mysql@5.7` (label: homebrew.mxcl.mysql@5.7)

5. 服务状态查询

% brew services list           Name      Status  User          File
mysql@5.7 started tanghonggang1 ~/Library/LaunchAgents/homebrew.mxcl.mysql@5.7.plist

6. 初始化配置

~ mysql_secure_installationSecuring 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
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) : N... skipping.
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! 

如果执行报错 zsh: command not found: mysql_secure_installation。执行

echo 'export PATH="/opt/homebrew/opt/mysql@5.7/bin:$PATH"' >> ~/.zshrc

7. 登录测试

7.1 终端登录

~ mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.7.43 HomebrewCopyright (c) 2000, 2023, Oracle and/or its affiliates.Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> 

7.2 客户端登录

在这里插入图片描述

参考

MySQL 5.7的Homebrew安装 - MacOS
macOS brew安装mysql和安装问题解决 关于zsh: command not found: mysql问题解决

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

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

相关文章

港陆证券:服装家纺公司上半年投资并购力度加大

9月1日,嘉曼服饰发布公告,为完善多品牌差异化开展战略,将以自有资金收买暇步士(Hush Puppies)品牌我国内地及香港、澳门区域IP财物。 面对服饰市场的激烈竞争,本年以来一些服饰类A股公司开启了“买买买”形…

SSRF服务端请求伪造

服务端请求伪造,其实就是攻击者构造恶意请求,服务端发起恶意请求,如果服务端不对用户传递的参数进行严格的过滤和限制,就可能导致服务端请求伪造 上面是百度识图,我们可以传递图片地址,百度识图向图片发起…

哈夫曼编码实现文件的压缩和解压

程序示例精选 哈夫曼编码实现文件的压缩和解压 如需安装运行环境或远程调试,见文章底部个人QQ名片,由专业技术人员远程协助! 前言 这篇博客针对《哈夫曼编码实现文件的压缩和解压》编写代码,代码整洁,规则&#xff0…

SQL Server2008下载地址

SQL Server2008下载地址 https://www.microsoft.com/zh-CN/download/details.aspx?id30438 版本说明 Microsoft SQL Server 2008 R2 Express Service Pack 2 是功能丰富的 SQL Server 免费版本,是学习、开发桌面、Web 及小型服务器应用程序并为它们提供功能的理…

Office365 Excel中使用宏将汉字转拼音

Office365 Excel中开启宏 文件 - 选项 - 信任中心 - 信任中心设值 - 宏设值 启用VBA宏启用VBA宏时启用Excel 4.0宏信任对VBA工程对象模型的访问 创建宏 视图 - 查看宏 填写名字创建宏:getpy填入下面代码保存,点击否,另存类型为“excel启…

C语言:字符函数和字符串函数(一篇拿捏字符串函数!)

目录 求字符串长度: 1. strlen(字符串长度) 长度不受限制函数: 2. strcpy(字符串拷贝) 3. strcat(字符串追加) 4. strcmp(字符串比较) 长度受限制函数: 5. strncpy(字符串拷贝) 6. strncat(字符串追加) 7. strncmp(字符串比较) 字…

【数据结构】查找

【数据结构】查找 数据结构中,有顺序查找、二分查找、散列查找、插值查找、斐波那契额查找 1.顺序查找 条件:待查找的元素与数组中的元素按顺序排列。算法:从数组的第一个元素开始,逐个比较,直到找到目标元素或遍历完…

【GAMES202】Real-Time Global Illumination(in 3D)—实时全局光照(3D空间)

一、SH for Glossy transport 1.Diffuse PRT回顾 上篇我们介绍了PRT,并以Diffuse的BRDF作为例子分析了预计算的部分,包括Lighting和Light transport,如上图所示。 包括我们还提到了SH,可以用SH的有限阶近似拟合球面函数&#xff…

购物商场项目实践

1.项目开始 1)此项目为在线电商项目 2)包含首页,搜索列表,商品详情,购物车,订单,支付,用户登录/注册等多个子模块 3)使用Vue全家桶ES6webpackAxios等前端技术 4&…

Pandas数据分析基础—pandas自带函数map()/apply()/applymap()

文章目录 前言一、Series数据处理1、map()方法2、apply()方法3、applymap()方法总结 二、DataFrame数据处理1、map()方法2、apply()方法3、applymap()方法总结 三、map、apply、applymap三个函数区别 前言 在进行数据处理时,经常会对一个DataFrame展开逐行、逐列、…

day7_网络编程

day7_网络编程 将文件内容拷贝到数据库 将文件内容拷贝到数据库 #include <stdio.h> #include <string.h> #include <stdlib.h> #include <errno.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include &l…

业务数据模拟/采集

业务数据模拟/采集 2.2 业务数据模拟 2.2.1 连接MySQL 通过MySQL可视化客户端连接数据库。2.2.2 建表语句 1&#xff09;通过SQLyog创建数据库2&#xff09;设置数据库名称为gmall&#xff0c;编码为utf-8&#xff0c;排序规则为utf8_general_ci3&#xff09;导入数据库结构脚本…

【AI】机器学习——绪论

文章目录 1.1 机器学习概念1.1.1 定义统计机器学习与数据挖掘区别机器学习前提 1.1.2 术语1.1.3 特点以数据为研究对象目标方法——基于数据构建模型SML三要素SML步骤 1.2 分类1.2.1 参数化/非参数化方法1.2.2 按算法分类1.2.3 按模型分类概率模型非概率模型逻辑斯蒂回归 1.2.4…

stable diffusion实践操作-提示词-人物服饰

系列文章目录 stable diffusion实践操作-提示词 文章目录 系列文章目录前言一、提示词汇总1.1 人物服饰11.2 人物服饰2 前言 本文主要收纳总结了提示词-人物服饰。 一、提示词汇总 1.1 人物服饰1 耳饰帽子内裤内衣上身饰品手部[月牙耳环][头顶光环][丁字裤][胸罩][披风][太…

redis 数据结构(二)

整数集合 整数集合是 Set 对象的底层实现之一。当一个 Set 对象只包含整数值元素&#xff0c;并且元素数量不时&#xff0c;就会使用整数集这个数据结构作为底层实现。 整数集合结构设计 整数集合本质上是一块连续内存空间&#xff0c;它的结构定义如下&#xff1a; typed…

避雷,软件测试常见的误区之一

随着软件规模的不断扩大&#xff0c;软件设计的复杂程度不断提高&#xff0c;软件开发中出现错误或缺陷的机会越来越多。同时&#xff0c;市场对软件质量重要性的认识逐渐增强。所以&#xff0c;软件测试在软件项目实施过程中的重要性日益突出。但是&#xff0c;现实情况是&…

ThreadPoolExecutor创建线程池

ThreadPoolExecutor创建线程池 线程池的所有创建方式选择哪种创建方式&#xff1f;ThreadPoolExecutor构造方法参数解释线程池的执行流程 线程池的所有创建方式 线程池的创建方式总共包含以下 7 种&#xff08;其中 6 种是通过 Executors 创建的&#xff0c;1 种是通过ThreadP…

2023_Spark_实验五:Scala面向对象部分演示(一)(IDEA开发)

1、面向对象的基本概念 把数据及对数据的操作方法放在一起&#xff0c;作为一个相互依存的整体——对象&#xff0c;面向 对象的三大特征&#xff1a; 封装 继承 多态 2、类的定义 简单类和无参方法 class Counter{private var value 0;def increment() { value1};def…

hiveserver2经常挂断的原因

hiveserver2经常挂断的原因 HiveServer2 经常挂断可能有多种原因&#xff0c;以下是一些可能导致挂断的常见原因&#xff1a; 资源不足&#xff1a;HiveServer2 需要足够的内存和 CPU 资源来处理查询请求。如果资源不足&#xff0c;可能会导致 HiveServer2 挂断。请确保在配置…

喜讯 | 数智经营新典范,体验家XMPlus荣获「年度数智经营服务商」

7月27日&#xff0c;“助力运营知识与创新传播”的内容服务平台——运营研究社举行了「2023数字化运营生态大会」&#xff0c;会上正式揭晓了「2023数字化运营生态大奖」的四大榜单&#xff0c;体验家XMPlus荣获「年度数智经营服务商」&#xff01;现场有800运营伙伴齐聚&#…