Mac利用brew安装mysql并设置初始密码

前言

之前一直是在windows上开发后段程序,所以只在windows上装mysql。(我记得linux只需要适应yum之类的命令即可)

另外, linux的移步 linux安装mysql (详细步骤,初次初始化,sql小例子,可视化操作客户端推荐)

好家伙,我佛了,写完当天网上发现自己之前写过一篇 brew 安装mysql (Mac OS), 不过那篇没有说如何设置初始密码.


安装mysql

brew install mysql

等它装完就好啦

开启mysql

mysql.server start

顺带一提,关闭命令是

mysql.server stop

设置初始密码

mysql_secure_installation

输入上面这个命令,就会提示你一系列操作,就可以设置我们的初始密码了

andydennis@192 ~ % mysql_secure_installationSecuring the MySQL server deployment.Enter password for user root: 
Error: Access denied for user 'root'@'localhost' (using password: YES)
andydennis@192 ~ % mysql_secure_installationSecuring the MySQL server deployment.Enter password for user root: 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: yThere are three levels of password validation policy:LOW    Length >= 8
MEDIUM Length >= 8, numeric, mixed case, and special characters
STRONG Length >= 8, numeric, mixed case, special characters and dictionary                  filePlease enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 0
Using existing password for root.Estimated strength of the password: 25 
Change the password for root ? ((Press y|Y for Yes, any other key for No) : yNew password: Re-enter new password: Estimated strength of the password: 25 
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y... Failed! Error: Your password does not satisfy the current policy requirementsNew password: Re-enter new password: Estimated strength of the password: 50 
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y
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) : ... 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) : ... skipping.
All done! 

这里密码需要大于等于8个,所以我设置了 root1234

然后就可以用我们熟悉的命令登录上mysql了

mysql -u root -p

输入密码 root1234


查看 有无启动

ps aux|grep mysqld

或者

ps -ef|grep mysqld

或者换一种思路,看3306端口号是否被占用

lsof -i :3306

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

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

相关文章

机器学习聚类算法

聚类算法是一种无监督学习方法,用于将数据集中的样本划分为多个簇,使得同一簇内的样本相似度较高,而不同簇之间的样本相似度较低。在数据分析中,聚类算法可以帮助我们发现数据的内在结构和规律,从而为进一步的数据分析…

electron获取元素xpath、pc端网页展示获取到的xpath、websocket给两端传值

目录 需求点:思路:思路:一、electron获取xpath1、创建主窗口2、创建子窗口并且setBrowserView到主窗口,子窗口默认加载error.html3、如果获取到了url,就加载url4、获取xpath并传递 二、electron通过websocket传递消息三…

深度学习缝模块怎么描述创新点?(附写作模板+涨点论文)

深度学习缝了别的模块怎么描述创新点、怎么讲故事写成一篇优质论文? 简单框架:描述自己这个领域,该领域出现了什么问题,你用了什么方法解决,你的方法有了多大的性能提升。 其中,重点讲清楚这两点&#xf…

开源计算机视觉库OpenCV详细介绍

开源计算机视觉库OpenCV详细介绍 1. OpenCV简介 OpenCV(Open Source Computer Vision Library)是一个开源的计算机视觉和机器学习软件库。它最初由Intel开发,现在由一个庞大的社区维护和更新。OpenCV旨在提供一个通用、跨平台的计算机…

QtAV学习:(一)Windows下编译QtAV

QtAV 主页: QtAV by wang-bin 作者的编译构建说明文档: Build QtAV wang-bin/QtAV Wiki GitHub 我的编译环境: 编译环境:win10/msvc2015/Qt5.6.3 第一步:GitHub拉取代码,执行子模块初始化 地址: …

2024-01-07-AI 大模型全栈工程师 - 做自己的产品经理

摘要 2024-01-07 周日 杭州 阴 本节内容: a. 如何做好独立开发设计,实现财富自由; 课程内容 1. 独立开发者 英文 indie hacker,是指独立开发软件产品的人;一人承担一个项目产品的所有工作; 2. 创业机会 云计算设…

JavaScript 设计模式之原型模式

原型模式 一般模式 所谓原型,一般就类似将数据放置到原型上,通过原型继承模式来实现一个基类,然后用子类继承方式来实现 // 汽车基类 const Car function (car,sale) {this.car car;this.sale sale;this.getName function () {}this.g…

C++ 内存模型

C内存模型 - MrYun - 博客园 (cnblogs.com) 内存区域 C内存分为5个区域:堆 heap : 由new分配的内存块,其释放编译器不去管,由我们程序自己控制(一个new对应一个delete)。如果程序员没有释放掉&#xff0c…

abap - 发送邮件,邮件正文带表格和excel附件

发送内容 的数据获取: 正文部分使用cl_document_bcs>create_document静态方法实现 传入参数为html内表结构 CLEAR lo_document .lo_document cl_document_bcs>create_document(i_type HTMi_text lt_htmli_length conlengthsi_subject lv_subje…

【漏洞复现】EPON上行A8-C政企网关信息泄露漏洞

Nx01 产品简介 EPON上行A8-C政企网关是一款终端产品,提供企业网络解决方案。 Nx02 漏洞描述 EPON上行A8-C政企网关敏感信息泄露漏洞,攻击者通过敏感信息泄露获取管理员密码。 Nx03 产品主页 fofa-query: "ZXECS" && title"Web…

网络安全红队基础建设与介绍

1.ATT&CK相关背景 ATT&CK在各种日常环境中都很有价值。开展任何防御活动时,可以应用ATT&CK防御法,参考攻击者及其行为。ATT&CK不仅对网络防御者提供通用技术库,还为渗透测试和红队提供了基础。提到对抗行为时,这为…

【机器学习】机器学习简单入门

🎈个人主页:甜美的江 🎉欢迎 👍点赞✍评论⭐收藏 🤗收录专栏:matplotlib 🤝希望本文对您有所裨益,如有不足之处,欢迎在评论区提出指正,让我们共同学习、交流进…

谷歌免费开放模糊测试框架OSS-Fuzz(物联网、车联网、供应链安全、C/C++)

目录 模糊测试的智能化和自动化 模糊测试不能代替安全设计原则 AI驱动的漏洞修补

<.Net>使用visual Studio 2022在VB.net中新添自定义画图函数(优化版)

前言 这是基于我之前的一篇博文: 使用visual Studio 2019在VB.net中新添自定义画图函数 在此基础上,我优化了一下,改进了UI,添加了示例功能,即以画圆函数为基础,添加了走马灯功能。 先看一下最终效果&#…

Google Chrome Close AutoUpdate

DOMException: play() failed because the user didn‘t interact with the document first.-CSDN博客 html5 audio video-CSDN博客 Google Chrome Close AutoUpdate 关闭google浏览器自动更新 1:检查是否已安装google浏览器,并卸载: 2&…

router路由跳转的两种模板

<router-link><router-link/> <router-view><router-view/> link &#xff1a;链接&#xff0c;联系 view&#xff1a;指看见展现在人们面前的、可以稳定地进行详细审视的事物 将语境拉回到router里&#xff0c;抽象概括一下 router-link就是一个…

docker compose安装minio

要使docker-compose管理的容器&#xff08;如MinIO&#xff09;在系统启动时自动启动&#xff0c;你需要使用Docker的重启策略。在你的docker-compose.yml文件中为MinIO服务添加restart策略即可实现这一目标。restart: always指令确保了在容器退出时总是重新启动容器&#xff0…

55. 右旋字符串(卡码网KamaCoder)

文章目录 55. 右旋字符串题目描述暴力优化&#xff1a;不能申请额外空间&#xff0c;只能在本串上操作思路代码 55. 右旋字符串 题目描述 字符串的右旋转操作是把字符串尾部的若干个字符转移到字符串的前面。给定一个字符串 s 和一个正整数 k&#xff0c;请编写一个函数&…

Spark SQL调优实战

1、新添参数说明 // Driver和Executor内存和CPU资源相关配置 --是否开启executor动态分配&#xff0c;开启时spark.executor.instances不生效 spark.dynamicAllocation.enabledfalse --配置Driver内存 spark.dirver.memory5g --driver最大结果大小&#xff0c;设置为0代…

SQLserver2008 r2 下载安装配置、使用、新建登录用户及通过Navicat远程连接

目录 一、下载 二、安装配置 1.安装 2.许可条款 3.安装程序支持文件 4.功能选择 5.实例配置 6.服务器配置 7.数据库引擎配置 8.Reporting Services 配置 9.安装进度 ​编辑 10.完成 三、使用 四、新建登录用户 1.新建登录名 2.常规 3.服务器角色 4. 用户映…