`
MauerSu
  • 浏览: 496934 次
  • 性别: Icon_minigender_1
  • 来自: 北京
文章分类
社区版块
存档分类
最新评论

Mac HomeBrew 安装 mysql

    博客分类:
  • mac
 
阅读更多
源:http://blog.csdn.net/lkxlaz/article/details/54580735
https://www.cnblogs.com/b-ruce/p/5851662.html
评:

Mac HomeBrew 安装 mysql
在网上看到各种教程,都会出现ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock'

1. 确保环境没有mysql

  brew remove mysql

  brew cleanup

2. 安装

  brew install mysql

3. 启动

  brew services start mysql

       设置开机启动: launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist (设置启动的命令可以通过 brew info mysql获得)

4.登录

     mysql -uroot
=====
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)
1
2
3
4
5
6
莫慌,提示说找不到mysql.sock。原因是mysql进程还没启动。
6. 启动mysql服务

mysql.server start
1
7.再运行

> mysql_secure_installation
1
发现成功执行命令

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!
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
8.
最后测试一下登陆

> mysql -u root -p
1
ALL DONE!
分享到:
评论

相关推荐

    解决mac使用homebrew安装MySQL无法登陆问题

    如果你电脑是Mac的,使用homebrew安装MySQL是一个非常便捷的方式,但是还是会出现一些问题。下面通过本文给大家介绍解决mac使用homebrew安装MySQL无法登陆问题,需要的朋友可以参考下

    mysql安装配置教程(win+mac)完整版

    在Windows部分,我们从下载MySQL安装程序开始,一直到配置MySQL数据库,覆盖了每个步骤的详细说明。无论你是初学者还是有经验的用户,都能够轻松跟随我们的步骤进行安装和配置。 在Mac部分,我们介绍了使用Homebrew...

    dbf2mysql-mac:使dbf2mysql可与Mac OS X兼容的一些修复程序

    如果您的系统找不到mysql_config程序,则可能必须明确说明在何处可以找到MySQL安装。 用您MySQL安装路径替换第24行和第25行,分别是/include/mysql和/lib 。 例如,如果您通过homebrew安装了MySQL,则其外观应如下...

    Mac MySQL重置Root密码的教程

    申明:本重置密码可直接对Homebrew安装的MySQL进行密码重置,对于其他方式安装的MySQL需要切换对应的安装目录即可。 安装MySQL后时间太长了会忘记密码,在这里总结一下忘记密码时如何重置本地MySQL Root密码。 所有...

    Mac上将brew安装的MySql改用Docker执行操作过程

    1:安装docker 自己找文档去 2:使用mysql官方发布的docker image,命令如下 docker pull mysql/mysql-server:5.7.16 ##(这是本文发布时候MySql最新稳定版,并且最好和本地的Mysql版本一致,否则第三步可能会有问题...

    Mac下MySQL的my.cnf配置文件在哪

    前情提示: ...(Mac)这里实际安装位置为mysql8.0-mac-xxx类似这种格式的,只是引用了快捷方式,在偏好设置里可以看到,而且也可以看到mysql文件夹左下角有个快捷键头。 一般情况下/usr/local/mysql/

    mac0S_brew慢的问题.zip brew使用国内镜像解决下载慢的问题

    Mac下使用国内镜像安装Homebrew,解决brew在mac下安装软件下载慢的问题,zip包内已经替换了国内镜像文件, Mac OS 安装 brew 已经替换国内源,直接使用即可 1.把 brew_install 复制到 /users目录 2.安装 ruby ./...

    macOS Sierra安装Apache2.4+PHP7.0+MySQL5.7.16

    Mac系统上虽然自带PHP和Apache,但是有时不是我们想要的版本呢。今天我们就在macOS Sierra(10.12.1)上安装比较新的版本的PHP版本,也就是PHP7.0+了。...关于Mac下Homebrew的安装在此就不做过多赘述了,

    mac下安装nginx和php

    mac下使用homebrew安装安装、配置nginx、mysql、php-fpm的方法。

    在Mac OS上搭建Nginx+PHP+MySQL开发环境的教程

    homebrew是mac下非常好用的包管理器,会自动安装相关的依赖包,将你从繁琐的软件依赖安装中解放出来。 安装homebrew也非常简单,只要在终端中输入: <!-- lang: shell --> ruby -e "$(curl -fsSL ...

    在centos7下安装和部署java8和mysql

    一般学习java和部署项目都是在本地部署,但是生产...我的服务器是有yum的,所以绝大部分的东西,用的上yum来安装的,类似mac os上面的homebrew,安装配置相对简单。 首先我们看看yum里面有那些java的版本: yum -y

    在Mac系统上配置MySQL以及Squel Pro

    特此记录Mac系统下如何安装、配置MySQL及其管理工具Squel Pro。 为什么选择MYSQL: 数据库有很多,为什么么我选择了MySQL呢。 关系型数据库 or NoSQL 近年来NoSQL大红大紫,其中佼佼者mongoDB更是方便易用。二者的...

    Mac OS上安装PostgreSQL的教程

    一直以来,我和 MySQL 这位久经考验的老朋友合作愉快。但自从了解了一点 PostgreSQL 后, 对其丰富的功能特性就十分着迷。比如字段类型原生支持 json, xml 和 array。跟 MySQL 比起来,感觉 PostgreSQL 更高级一些。 ...

    Mac环境下php操作mysql数据库的方法分享

    Mac本地环境搭建 在Mac系统,我们可以使用MAMP Pro 软件来搭建本地服务器。安装好这款软件,网站的目录在 /Applications/MAMP/htdocs 文件夹里,只需将文件放入该文件夹中,就可以通过http://localhost:8888来访问了...

    Mac OS下PHP环境搭建及PHP操作MySQL常用方法小结

    Mac本地环境搭建 在Mac系统,我们可以使用MAMP Pro (官方网站:https://www.mamp.info/en/)软件来搭建本地服务器。安装好这款软件,网站的目录在 /Applications/MAMP/htdocs 文件夹里,只需将文件放入该文件夹中,...

    chef-applications:一本基于枢轴工作台的菜谱,但没有很多自定义提供程序,也没有很多清洁工

    本食谱提供了一个名为homebrew_package的软件包提供程序,它将使用Homebrew安装/删除软件包。 如果您的平台是Mac OS X,它将成为package的默认提供package 。 当这扩展了Chef中的内置包资源/提供程序时,它具有包...

    Mac开发配置手册

    如何让一部全新的macbook快速完成开发环境配置。 如果你是一名老手,本手册让你减少配置开发环境带来的烦恼; 如果你是一名新手,恭喜你,你讲认识一个全新的世界。...xcode,homebrew,iterm2,git,mysql,apps

    java8看不到源码-simplepay-server:SimplePay服务器端代码

    homebrew,请在你的 mac 上安装它 在 IntelliJ 中导入 git clone https://github.com/nayeemzen/koin-server 打开 IntelliJ Idea(可以免费获得社区版) 选择Import Project 选择koin-server文件夹 从 external_...

    lpdw2.0:重新设计Professional License 2.0网站

    在Mac上安装MySQL和HomeBrew是必不可少的。 efstest 1)您必须您的帐户中存款。 2)克隆您以前的分叉存储库: git clone https://github.com/TON_PSEUDO/lpdw2.0.git 3)添加一个“上游”远程服务器,以便能够将...

Global site tag (gtag.js) - Google Analytics