[Mac 10.13.4] 使用Homebrew安装Mysql全过程_ta[email protected] / % mysql_sec_明明如月学长的博客-程序员秘密

技术标签: 工具使用  Java基础  问题积累  

环境

操作系统:macOS High Sierra Version 10.13.4

Homebrew:1.6.4

步骤

  1. 安装Homebrew,详细步骤参见Homebrew官网。
  2. brew doctor确认brew在正常工作。
  3. brew update更新包。
  4. brew install mysql 安装mysql。

其中运行mysql_secure_installation 可以设置密码

运行brew service start mysql 可以后台启动mysql
运行mysql.server start 前台启动mysql(关闭控制台,服务停止)

5 按照brew的提示运行 mysql_secure_installation设置密码,运行后会报错:

 > mysql_secure_installation

Securing the MySQL server deployment.

Enter password for user root:
Error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

这个错误是因为MySQL服务还没启动

6、启动MySQL服务

mysql.server start 

在我的机器上第一次没报错,以后运行此命令有可能会报权限错误。尝试修改权限但是最后还是不行,最后采用sudo启动解决此问题。

sudo mysql.server start

7、设置密码

mysql_secure_installation

如果报权限错误执行 sudo 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: y

There 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                  file
// 这里提示选一个密码强度等级
Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 1
Please set the password for root here.
// 然后按照所选的密码强度要求设定密码
New 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
 ... Failed! Error: Your password does not satisfy the current policy requirements

New password:

Re-enter new password:

Estimated strength of the password: 100
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.
// 禁止远程root登录,我选的是不禁止。因为我的mac上的数据库不会放到公网上,也不会存什么敏感数据
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : no

 ... 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.

// 这里删除默认自带的test数据库
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!

8、连接MySQL

mysql -u root -p

最后特别注意启动方式的问题:

运行brew service start mysql 可以后台启动mysql

运行mysql.server start 前台启动mysql

如果提示权限问题使用sudo指令,我的笔记本上如果不加此指令各种权限问题。

 

 

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/w605283073/article/details/80417866

智能推荐

Unity Shader 卡通渲染 (三):仿塞尔达荒野之息 Shader(顶点色控制细节)_西河某人的博客-程序员秘密

上一篇传送门:https://blog.csdn.net/qq_27534999/article/details/100925621顶点色在卡通渲染中有挺多应用,本篇会在上一篇的基础上,运用模型顶点色来控制细节。塞尔达荒野之息不一定是用这种方法,也可能是用额外的贴图来实现,这里算是抛砖引玉一下,扩展一下思路。(不过这方法效果还挺不错哦!)用顶点色控制细节还是有很多好处的,首先就是效果比...

计算机丢失mfc140 dll,mfc140d.dll_weixin_39849800的博客-程序员秘密

mfc140d.dll是存放在Windows系统中的一个非常重要dll文件,缺少它就会造成部分软件或游戏不能正常运行。当用户的电脑弹出提示“无法找到mfc140d.dll”或“计算机缺少mfc140d.dll”等错误问题,请下载本站为你提供的dll文件,使用它可以帮助用户解决上述问题。基本简介DLL(Dynamic Link Library)文件为动态链接库文件,又称“应用程序拓展”,是软件文件类...

for i, data in enumerate(trainloader, 0): 解释_enumerate(train_loader)_科研dog_java的博客-程序员秘密

查阅python官方文档enumerate返回的枚举对象:如[(0, ‘spring’), (1, ‘summer’)]其中i,data 第一次循环时分别就是 0 、spring ,第二次循环就是 1 、 summer在for i , data in enumerate(trainloader, 0)中我们常碰见0变为1,其实就是将索引从0开始修改为从1开始,那么i,data 第一次循环时分别就是 1 、spring ,第二次循环就是 2 、 summer希望我的回答对你有帮助,点个赞再走吧,谢谢

综述论文:图像标注中的BoW表示 Bag-of-Words Representation in Image Annotation: A Review_GarfieldEr007的博客-程序员秘密

Chih-Fong TsaiDepartment of Information Management, National Central University, Jhongli 32001, TaiwanReceived 26 August 2012; Accepted 19 September 2012Academic Editors: F. Camastra, J. A

企业财务制度二--会计科目名称和编号(一)1605 在建工程减值准备(转载)_cqwmy840702的博客-程序员秘密

企业财务制度二--会计科目名称和编号(一)1605 在建工程减值准备1605 在建工程减值准备  一、本科目核算企业在建工程计提的减值准备。  二、企业应当定期或者至少于每年年度终了,对在建工程进行全面检查,如果有证据表明在建工...

2018_WWW_Dual Graph Convolutional Networks for Graph-Based Semi-Supervised Classification_XingHe_XingHe_的博客-程序员秘密

2018_WWW_Dual Graph Convolutional Networks for Graph-Based Semi-Supervised Classification—(The World Wide Web Conference, 2018.04.23)-- Chenyi Zhuang, Qiang Ma论文下载地址: https://doi.org/10.1145/3178876.3186116发表期刊:IW3C2 (International World Wide Web Confere

随便推点

Glide加载webp动画及监听动画播放结束_webpdecoder_黄毛火烧雪下的博客-程序员秘密

一、webpdecoder 源码https://github.com/zjupure/GlideWebpDecoder二、 引入 // webpdecoder implementation "com.github.zjupure:webpdecoder:2.0.4.13.1" // glide 4.10.0+ implementation "com.github.bumptech.glide:glide:4.13.1" annotationProcessor "c

svn版本管理系统的安装 centos+subversion+apache+jsvnadmin_li20040723的博客-程序员秘密

转自吴水成视频CI 服务器:192.168.4.221 root 用户操作 建议安装前更新操作系统 # yum update 更新完成后重启 # reboot 安装 apache # yum install httpd httpd-devel # service httpd start # chkconfig ht

卷积神经网络和CIFAR-10:Yann LeCun专访 Convolutional Nets and CIFAR-10: An Interview with Yann LeCun_GarfieldEr007的博客-程序员秘密

Recently Kaggle hosted a competition on the CIFAR-10 dataset. The CIFAR-10 dataset consists of 60k 32x32 colour images in 10 classes. This dataset was collected by AlexKrizhevsky, Vinod Nair, and

FFMPEG 音频转换命令 wav转amr,视频压缩、视频封面截取_bang152101的博客-程序员秘密

音频转换:1.转换amr到mp3:ffmpeg -i shenhuxi.amr amr2mp3.mp32.转换amr到wav:ffmpeg -acodec libamr_nb -i shenhuxi.amr amr2wav.wav3.转换mp3到wav:ffmpeg -i DING.mp3 -f wav test.wav4.转换wav到amr:ffmpeg -i test.wav -acodec libamr_nb -ab 12.2k -ar 8000 -ac 1 w

计算机中丢失mfc100d.dll,mfc100d.dll_weixin_39956350的博客-程序员秘密

mfc100d.dll文件是一种微软系统重要的dll文件,如果你的电脑显示没有找到mfc100d.dll文件或者丢失mfc100d.dll文件等信息,你可以下载mfc100d.dll文件来解决上述问题,有需要的朋友欢迎下载使用!dll文件简介:DLL(Dynamic Link Library)文件为动态链接库文件,又称“应用程序拓展”,是软件文件类型。在Windows中,许多应用程序并不是一个完整...

推荐文章

热门文章

相关标签