`
MauerSu
  • 浏览: 520467 次
  • 性别: 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无法登陆问题,需要的朋友可以参考下

    MacOS安装MySql8.0.19及安装报错解决方案.docx

    首先,使用 Homebrew 安装 MySql,可以使用以下命令: ``` brew install mysql ``` 安装完成后,可以使用以下命令查看 MySql 操作信息: ``` brew info mysql ``` 二、运行 Mysql 服务 启动 MySql 服务可以使用以下...

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

    ### MySQL安装配置教程(Win+Mac)完整版 #### 一、Windows环境下MySQL的安装与配置 ##### **1. 下载MySQL安装程序** - **访问MySQL官网**:首先,通过浏览器访问MySQL官方网站(<https://dev.mysql....

    Mysql for mac 安装及Navicat客户端链接.docx

    Mysql for Mac 安装及 Navicat 客户端链接 本文档将指导您如何在 Mac 上安装 Mysql 并连接 Navicat 客户端。安装 Mysql 需要通过客户端安装和命令行安装两种方式,可以根据自己的需求选择合适的安装方式。 一、...

    Mac下MySQL安装及配置

    在Mac操作系统上安装和配置MySQL是一项常见的任务,无论是开发人员为了本地开发环境,还是系统管理员为了搭建服务器。本文将详细讲解如何在MacOS系统中安装MySQL,并进行基本的配置。 首先,MySQL的安装通常有两种...

    mac安装了mysql链接不上,直接就启动报错.pdf

    6. **修复损坏的MySQL安装**: - 如果上述方法都无效,可能需要卸载并重新安装MySQL。在执行此操作之前,记得备份重要的数据和配置文件。 7. **系统日志分析**: - 查看系统的日志文件,如`/var/log/system.log`...

    MySQL 5.7.27详细下载安装配置教程

    - **Mac**:双击.dmg文件,将MySQL拖到应用程序文件夹中,然后使用Homebrew或其他包管理器安装依赖项并启动MySQL服务。 **3. 配置MySQL** 安装完成后,需要配置MySQL服务器。主要的配置文件是`my.cnf`,通常位于`/...

    安装MySQL.txt

    根据提供的文件标题、描述、标签以及部分内容,我们可以总结并详细阐述关于MySQL安装的相关知识点。 ### 安装MySQL #### MySQL支持的操作系统 在安装MySQL之前,首先要了解MySQL支持哪些操作系统。MySQL采用GNU ...

    MySQL8.4.0 LTS(mysql-8.4.0-macos14-arm64.dmg)

    MySQL8.4.0 LTS(mysql-8.4.0-macos14-arm64.dmg)适用于macOS arm64系统。

    MySQL5.1安装图解

    在Mac OS上,可以使用Homebrew来安装MySQL,命令为`brew install mysql`。安装后,使用`mysql_secure_installation`脚本来加强安全性,设置root用户的密码和其他安全选项。 安装完成后,你需要了解如何管理和操作...

    windows 和mac下的mysql 8.0的安装教程

    例如,如果MySQL安装在C:\mysql\mysql-8.0.25-winx64\bin,那么需要将此路径添加到PATH变量。 4. **配置MySQL Server**:运行MySQL的配置工具“my.ini”,在“配置类型”中选择“Developer Machine”,确保足够的...

    图解MYSQL安装指南

    3. **Mac OS上的MySQL安装**: - 可以通过Homebrew安装:`brew install mysql`。 - 初始化数据库:`mysql_secure_installation`命令,设置root密码。 4. **MySQL的基本配置**: - 修改配置文件:在Windows上是my...

    Mysql_8.0安装与卸载教程+navicat12通用版安装教程

    你可以通过Homebrew(一个包管理器)来安装,首先需要安装Homebrew,然后在终端输入命令`brew install mysql`。安装完成后,你需要配置环境变量,使其能在命令行中正常使用。同时,为了安全起见,你应该创建一个my....

    MySql安装步骤,

    一、MySQL安装 1. **选择版本**: 首先,你需要从MySQL官网下载适合你操作系统的安装包。对于Windows用户,通常选择“Windows MSI Installer”;对于Linux用户,可以选择“Linux二进制包”;Mac用户则可以在Homebrew...

    MySql及安装

    - **macOS**:可以通过Homebrew来安装,命令为`brew install mysql`。 5. **初始化MySQL** 安装完成后,首次启动MySQL服务,系统会自动进行初始化,包括设置root用户的默认密码。在某些情况下,你可能需要手动...

    什么是mysql安装配置教程以及学习mysql安装配置教程的意义

    - **Mac OS系统**:可以通过Homebrew安装MySQL,使用命令`brew install mysql`。 ##### 3. 配置MySQL - **设置root用户密码**:安装完成后首次运行MySQL时,会提示设置root用户的初始密码,确保密码强度足够高以...

    mysql数据库以及安装教程

    以下是一份详细的MySQL安装教程,旨在帮助初次接触数据库的新手顺利安装并理解MySQL的基本操作。 **一、系统需求** 在开始安装之前,确保你的操作系统满足MySQL的最低要求。对于Windows用户,MySQL支持Windows 7及...

    安装MySQL数据库的步骤通常包括下载安装包

    以下是一个详细的MySQL安装教程: 1. **下载安装包**: 在开始安装前,你需要访问MySQL官方网站(https://www.mysql.com/)下载适合你操作系统的安装包。对于Windows用户,可以选择“MySQL Community Server”并...

    MYSQL数据库安装图解

    Mac用户通常可以通过Homebrew来安装MySQL。 **步骤1:下载MySQL安装包** 访问MySQL官方网站(https://www.mysql.com/),选择适合你操作系统的下载选项。通常会提供多种版本,包括社区版(免费)和企业版(付费)。...

Global site tag (gtag.js) - Google Analytics