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.hqwc.cn/news/456570.html

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

相关文章

网络原理HTTP/HTTPS(1)

文章目录 HTTP抓包工具FIddler**HTTP请求****HTTP响应** 认识URLURL encode认识"方法"(method)1.GET方法使用Fiddler观察GET请求 2.POST方法使⽤Fiddler观察POST⽅法 经典面试题:GET和POST有啥区别请求报头(header)HostContent-Len…

【webpack】优化提升

webpack优化提升 安装webpack相关内容向下兼容游览器-babel/polyfill进一步优化babel/polyfill模块联邦-共享模块如何提升构建性能通用环境下1,webpack更新到最新版本2,将loader应用于最少数量的必要模块3,引导(每个额外的loader/…

《C程序设计》上机实验报告(七)之指针的应用

实验内容&#xff1a; 1.运行程序 #include <stdio.h> void main() { int a10,*p; p&a; printf("%d",*p); scanf("%d",p); printf("%x",p); printf("%x",&p); *p5; printf("%d"…

【Java数据结构】单向 不带头 非循环 链表实现

模拟实现LinkedList&#xff1a;下一篇文章 LinkedList底层是双向、不带头结点、非循环的链表 /*** LinkedList的模拟实现*单向 不带头 非循环链表实现*/ class SingleLinkedList {class ListNode {public int val;public ListNode next;public ListNode(int val) {this.val …

20240203在Ubuntu20.04.6下配置stable-diffusion-webui.git

20240203在Ubuntu20.04.6下配置stable-diffusion-webui.git 2024/2/3 11:55 【结论&#xff1a;在Ubuntu20.04.6下&#xff0c;生成512x512分辨率的图像&#xff0c;大概需要11秒钟&#xff01;】 前提条件&#xff0c;可以通过技术手段上外网&#xff01;^_首先你要有一张NVID…

【Spring基础】从0开始学习Spring(2)

前言 在上篇文章&#xff0c;我已经讲了Spring中最核心的知识点&#xff1a;IoC&#xff08;控制反转&#xff09;以及DI&#xff08;依赖注入&#xff09;。这篇文章&#xff0c;我将讲一下关于Spring框架中的其它比较琐碎但是又还是挺重要的知识点&#xff0c;因此&#xff…

Windows中如何使用 Anaconda 和 gempy地质建模

GemPy是一个免费开源的Python软件包&#xff0c;主要用于建立三维地质模型。以下是windows下GemPy的安装过程。 一、&#xff08;可选步骤&#xff09;N卡加速 如果使用的是英伟达的RTX显卡&#xff0c;可以去N卡官网下载cuda安装包以启用GPU加速。 首先检查显卡支持的CUDA版…

六轴机器人奇异点

1 奇异点说明 有着6个自由度的KUKA机器人具有3个不同的奇点位置。即便在给定状态和步骤顺序的情况下,也无法通过逆向变换(将笛卡尔坐标转换成极坐标值)得出唯一数值时,即可认为是一个奇点位置。这种情况下,或者当最小的笛卡尔变化也能导致非常大的轴角度变化时,即为奇点位置…

6-2、T型加减速计算简化【51单片机+L298N步进电机系列教程】

↑↑↑点击上方【目录】&#xff0c;查看本系列全部文章 摘要&#xff1a;本节介绍简化T型加减速计算过程&#xff0c;使其适用于单片机数据处理。简化内容包括浮点数转整型数计算、加减速对称处理、预处理计算 一、浮点数转整型数计算 根据上一节内容已知 常用的晶振大小…

C++ PE文件信息解析

尝试解析PE文件结构, 于是编写了此PE信息助手类, 暂时完成如下信息解析 1.导出表信息(Dll模块, 函数) 2.导入表信息(Dll模块, 函数) 3.资源表信息(字符串表, 版本信息, 清单信息) CPEHelper.h #pragma once// // brief: PE文件解析助手类 // copyright: Copyright 2024 Flame…

ai扩图怎么玩?分享玩法和工具!

AI扩图是近年来兴起的图片处理技术&#xff0c;它通过人工智能算法&#xff0c;将一张小图片放大并修复&#xff0c;使其呈现出高清晰度的效果。这项技术对于我们日常的图片处理工作来说&#xff0c;无疑是一大福音。本文将为你详细解析AI扩图的玩法&#xff0c;以及介绍一些实…

力扣经典题:另一棵树的子树

直接省事一点&#xff0c;炒一下100题的代码&#xff0c;分别讨论单节点以及双空节点的情况&#xff0c;然后进行递归调用 bool isSameTree(struct TreeNode* p, struct TreeNode* q) {if(pNULL&&qNULL){return true;}if(pNULL||qNULL){return false;}if(p->val!q-…