1. 安装 Homebrew
  2. brew doctor 确认 brew 在正常工作
  3. brew update 更新包
  4. brew install mysql 安装 MySQL

==> Downloading https://homebrew.bintray.com/bottles/mysql-5.7.17.sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring mysql-5.7.17.sierra.bottle.tar.gz
==> Using the sandbox
==> /usr/local/Cellar/mysql/5.7.17/bin/mysqld --initialize-insecure --user=liangze --basedir=/usr/local/Cellar/mysql/5.7.17 --datadir=/usr/local/var/mysql --t
==> Caveats
We've installed your MySQL database without a root password. To secure it run:
mysql_secure_installation

To connect run:
mysql -uroot

To have launchd start mysql now and restart at login:
brew services start mysql
Or, if you don't want/need a background service you can just run:
mysql.server start
==> Summary
/usr/local/Cellar/mysql/5.7.17: 14,226 files, 444.4M



安装成功之后,我们需要先启动 mysql 服务

mysql.server start



然后再运行

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!



最后我们就可以进行登录了。



学会使用brew info 软件名来查看提示。

Homebrew 安装 MySQL的更多相关文章

  1. mac系统homebrew安装mysql

    homebrew 安装 mysql homebrew 是 macOS 缺失的软件包管理器,譬如可以下载 mysql.redis.wget 等等.操作系统:macOS High Sierra Versi ...

  2. mac 使用homebrew 安装mysql

    1. 安装homebrew ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)" brew update ...

  3. Mac下 homebrew 安装mysql

    操作步骤 安装homebrew brew install mysql 安装mysql 安装完成之后,可以运行命令启动mysql服务 mysql.server start 然后输入命令设置密码 mysq ...

  4. Mac通过homebrew 安装mysql

    来源:http://timtang.me/blog/2011/12/07/mac-homebrew-mysql/ 使用MBP有一年了,开始想在工作中使用mac由于各种不习惯最终失败,导致自己使用了一年 ...

  5. 使用Homebrew安装MySQL

    安装命令: brew install mysql 安装完成之后,启动mysql: mysql.server start 发现无此命令: command not found 首先,检查是否是安装了.重新 ...

  6. Homebrew 安装mysql

    在mac上安装软件,无疑安装一个brew是个很好的选择,关于brew是什么,怎么安装建议去brew官网查看, 附上地址:brew官网  还有一篇博文 http://www.cnblogs.com/xd ...

  7. Mysql学习(四)之通过homebrew安装mysql后,为什么在系统偏好设置里没有mysql

    原因 用brew install packagename是用来安装命令行工具的,一般不可能影响到图形界面. mysql官方文档是通过dmg文件安装的: The MySQL Installation P ...

  8. Mysql学习(二)之通过homebrew安装mysql后,为什么在系统偏好设置里没有mysql

    原因 用brew install packagename是用来安装命令行工具的,一般不可能影响到图形界面. mysql官方文档是通过dmg文件安装的: The MySQL Installation P ...

  9. Mac 命令行安装mysql homebrew 安装mysql后,如何配置mysql

    非常好 强力推荐 这个是我最新并且一直推崇的方法:1.安装:sunyichaodeMacBook-Pro:~ sunyichao$ brew install mysql2.开启mysql:mysql. ...

随机推荐

  1. *2-3-7-加入field_automation机制

    在2.3.3节中引入my_mointor时,在my_transaction中加入了my_print函数: 在2.3.5节中引入reference model时,加入了my_copy函数: 在2.3.6 ...

  2. 开发一个 Windows 级别的操作系统难度有多大?

    在搜索进程相关问题的时候,无意间看到了知乎上面的这个问题,这也是困惑我的问题,只是自己比较懒,没有刨根问底,这次无意间看到了,并且认真看了大神的回答,很受启发,作为记录,贴于此,与各位分享: 来源:知 ...

  3. 如何用webgl(three.js)搭建不规则建筑模型,客流量热力图模拟

    本节课主要讲解如何用webgl(three.js)搭建一个建筑模型,客流量热力图模拟 使用技术说明: 这里主要用到了three.js,echart.js以及一些其它的js 与css技术,利用webso ...

  4. Struts2页面开发中常用标签使用说明

    1. Struts2页面开发中常用标签使用说明 1.1.往action里传值的使用方式: <input name="userName" type="text&quo ...

  5. C# 时间操作类

    using System; namespace DotNet.Utilities { /// <summary> /// 时间类 /// 1.SecondToMinute(int Seco ...

  6. Android Viewpage 滑块

    依赖: implementation 'com.android.support:appcompat-v7:28.0.0' 在主页面layout <android.support.v4.view. ...

  7. 使用重绘项美化WinForm中的控件

    如果你觉得项目中的ComboBox.ListBox或其它的Winforms控件不能满足你的显示要求,包括窗体在内很多控件都支持重绘修改显示样式.下面的示例完成对ComBox数据项的重绘,希望能起到抛砖 ...

  8. golang 编码转化

    在网上搜索golang编码转化时,我们经常看到的文章是使用下面一些第三方库: https://github.com/djimenez/iconv-go https://github.com/qiniu ...

  9. JavaWeb学习总结(十一):Session解决form表单重复提交

    在平时开发中,如果网速比较慢的情况下,用户提交表单后,发现服务器半天都没有响应,那么用户可能会以为是自己没有提交表单,就会再点击提交按钮重复提交表单,我们在开发中必须防止表单重复提交. 一.表单重复提 ...

  10. Java学习笔记(3)----网络套接字服务器多线程版本

    本例给出一个客户端程序和一个服务器程序.客户端向服务器发送数据.服务器接收数据,并用它来生成一个结果,然后将这个结果返回给客户端.客户端在控制台上显示结果.在本例中,客户端发送的数据是圆的半径,服务器 ...