1.使用 homebrew 安装:

brew install mysql

结果报错:

$ brew install mysql
==> Downloading http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.19.tar.gz/from/http://cdn.mysql.com/ curl: () The requested URL returned error: Not Found
Error: Download failed: http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.19.tar.gz/from/http://cdn.mysql.com/

这时升级一下你的 homebrew:

brew update

安装完成后,然后又报错:

Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink share/man/man8/mysqld.
/usr/local/share/man/man8 is not writable.

真是坎坷。。。

解决方法:

#开启权限
$ sudo chown -R $(whoami) /usr/local/
#重新link一次
$ brew link mysql

这下总算安装完成了。

2.配置 mysql :

进入 sql 指令模式:

mysql -uroot -p

然后报错:

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

表明我们没有启动 mysql 服务。

所以启动服务:

mysql.server start

3.设置 root 账户密码:

mysql_secure_installation

然后出现下列配置选项:

(1)

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:
Please set the password for root here.
New password:
Re-enter new password:

询问你是否安装 VALLDATE PASSWORD 这个套件(可以帮助你验证密码的复杂度,设置的太简单会提醒你),我并没有安装这个套件,直接 enter 后输入两次密码结束。

(2)

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 。

(3)

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) :

是否关闭 root 远端登入?选 y 。

(4)

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) :

是否移除测试资料库?选 y 。

(5)

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 。

4.再次尝试进入 sql 指令模式:

mysql -uroot -p

成功!

到这步我们便完成了 MySQL 的安装。

******

以Service方式启动/停止/重启MySQL命令:

service mysqld start

service mysqld stop

service mysqld restart

Mac 下安装 MySQL 经历的更多相关文章

  1. Mac下安装Mysql出现 Can’t connect to local MySQL server through socket '/tmp/mysql.sock'

    在Mac下安装mysql出现 Can't connect to local MySQL server through socket '/tmp/mysql.sock' 错误,解决如下: $ unset ...

  2. 配置apache,及mac下安装mysql

    先打开apache,在浏览器上输入  localhost     回车后会如果屏幕上显示:It works! 如下图: 这说明你的apache已开启 在window下配置apache: 1.找到apa ...

  3. mac 初次配置apache,及mac下安装mysql

    先打开apache,在浏览器上输入  localhost     回车后会如果屏幕上显示:It works! 如下图: 这说明你的apache已开启 mac 下apache配置(mac自带apache ...

  4. Mac下安装MySQL 5.6.40

    Mac下安装MySQL 5.6.40 - 干勾鱼的CSDN博客 - CSDN博客   原创 Mac下安装MySQL 5.6.40 2018-06-18 10:34:03 我是干勾鱼 阅读数 5927 ...

  5. 在Mac下安装MySQL

    在Mac下安装MySQL   最近开始将开发工具都转移到 Mac 上了,其中也会莫名其妙的遇到一些坑,不如干脆将整个流程都记录下来,方便以后查找. 下载与安装 首先进入 MySQL 官网,选择免费的C ...

  6. Mac 下安装 MySQL 步骤

    安装 MySQL Mac 下安装MySQL推荐去官网下载dmg 版本的,我使用的版本是5.7.30. 如上图所示. 之后就是傻瓜式一键狂点不过需要注意的是,不要关闭下图所示的框框!不要关闭下图所示的框 ...

  7. Mac下安装MySQL及启动等常用命令

    总结了下mac下的mysql安装步骤:   eclipse JavaEE 下载         JDK -9 macosx下载   一.安装及启动服务 1. MySQL Server 下载.(以mys ...

  8. Mac下安装Mysql以及修改Mysql密码

    1.安装Mysql 安装有2种办法,一种是下载mysql安装文件,慢慢安装,另一种就是下载xmpp,里面自带mysql,就像是安装普通的mac软件一样,安装完毕,就有了mysql了. 方法一,官网下载 ...

  9. mac下安装mysql 1820 重置默认密码

    mac安装mysql时会给出一个临时密码 记录下来 2018-03-17T02:14:10.809431Z 1 [Note] A temporary password is generated for ...

随机推荐

  1. codeforce round#466(div.2)C. Phone Numbers

    C. Phone Numbers time limit per test2 seconds memory limit per test256 megabytes inputstandard input ...

  2. string和c_str()使用时的坑

    先看一段代码和它的运行结果: 看到结果了么这个运行的结果和我们理解的是不会有差距.对于经验丰富的开发者可能会微微一笑,但是对于一个刚刚学习的人就开始疑惑了.这里主要说两个问题: 1.声明了一个stri ...

  3. Kettle 初始配置数据量类型资源库

    PS:有段时间不使用Kettle了,但总遇到小伙伴问起,写一篇记录下. 文档使用版本:KETTLE 7.0 Kettle资源库可分为文件与数据库,文件型只需要配置好存放路径就行,这边介绍的是配置数据库 ...

  4. Vim配置及使用技巧

    要说Linux下比较好用的文本编辑器,我推荐vim(当然很多人都用emacs,可我没用过),用vim也有一年左右,有些心得体会想与诸位分享.在我的学习过程中,借鉴了不少优秀的博客,其中有csdn大神n ...

  5. LeetCode---Container With Most Water(11)

    Description: Given n non-negative integers a1, a2, ..., an, where each represents a point at coordin ...

  6. Alpha冲刺Day2

    Alpha冲刺Day2 一:站立式会议 今日安排: 首先完善前一天的剩余安排工作量,其次我们把项目大体分为四个模块:数据管理员.企业人员.第三方机构.政府人员.数据管理员这一模块,数据管理员又可细分为 ...

  7. python 继承基础

    class annamal: def chi(self): print(self.name + '吃') def he(self): print(self.name + '喝') class dog( ...

  8. const volatile同时限定一个类型int a = 10

    const和volatile放在一起的意义在于: (1)本程序段中不能对a作修改,任何修改都是非法的,或者至少是粗心,编译器应该报错,防止这种粗心: (2)另一个程序段则完全有可能修改,因此编译器最好 ...

  9. LeetCode & Q26-Remove Duplicates from Sorted Array-Easy

    Descriptions: Given a sorted array, remove the duplicates in place such that each element appear onl ...

  10. 算法题丨3Sum Closest

    描述 Given an array S of n integers, find three integers in S such that the sum is closest to a given ...