使用Homebrew安装MySQL
安装命令:
brew install mysql
安装完成之后,启动mysql:
mysql.server start
发现无此命令:
command not found
首先,检查是否是安装了。重新执行一遍:
brew install mysql
提示:
Warning: mysql-5.7.17 already installed, it's just not linked
然后网上查找解决方法,执行:
brew link --overwrite mysql
报错:
Linking /usr/local/Cellar/mysql/5.7.17...
Error: Could not symlink share/man/man8/mysqld.8 /usr/local/share/man/man8 is not writable.
查找解决方法,以下语句执行成功:
sudo chown -R 'username' /usr/local
解决了问题后,重新执行:
brew link --overwrite mysql
提示:
Linking /usr/local/Cellar/mysql/5.7.17... 93 symlinks created
重新执行:
mysql.server start
没有错误。表示这时我们已经启动mysql服务器,按照brew的提示设置管理员密码。
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 >=
MEDIUM Length >= , numeric, mixed case, and special characters
STRONG Length >= , numeric, mixed case, special characters and dictionary file
// 这里提示选一个密码强度等级
Please enter = LOW, = MEDIUM and = STRONG:
Please set the password for root here.
// 然后按照所选的密码强度要求设定密码
New password: Re-enter new password: Estimated strength of the password:
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:
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!
执行:
mysql -r root -p
输入密码,成功进入:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 5.7.17 Homebrew
测试一下:
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
4 rows in set (0.03 sec)
全部
使用Homebrew安装MySQL的更多相关文章
- mac系统homebrew安装mysql
homebrew 安装 mysql homebrew 是 macOS 缺失的软件包管理器,譬如可以下载 mysql.redis.wget 等等.操作系统:macOS High Sierra Versi ...
- Homebrew 安装 MySQL
安装 Homebrew brew doctor 确认 brew 在正常工作 brew update 更新包 brew install mysql 安装 MySQL ==> Downloadi ...
- mac 使用homebrew 安装mysql
1. 安装homebrew ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)" brew update ...
- Mac下 homebrew 安装mysql
操作步骤 安装homebrew brew install mysql 安装mysql 安装完成之后,可以运行命令启动mysql服务 mysql.server start 然后输入命令设置密码 mysq ...
- Mac通过homebrew 安装mysql
来源:http://timtang.me/blog/2011/12/07/mac-homebrew-mysql/ 使用MBP有一年了,开始想在工作中使用mac由于各种不习惯最终失败,导致自己使用了一年 ...
- Homebrew 安装mysql
在mac上安装软件,无疑安装一个brew是个很好的选择,关于brew是什么,怎么安装建议去brew官网查看, 附上地址:brew官网 还有一篇博文 http://www.cnblogs.com/xd ...
- Mysql学习(四)之通过homebrew安装mysql后,为什么在系统偏好设置里没有mysql
原因 用brew install packagename是用来安装命令行工具的,一般不可能影响到图形界面. mysql官方文档是通过dmg文件安装的: The MySQL Installation P ...
- Mysql学习(二)之通过homebrew安装mysql后,为什么在系统偏好设置里没有mysql
原因 用brew install packagename是用来安装命令行工具的,一般不可能影响到图形界面. mysql官方文档是通过dmg文件安装的: The MySQL Installation P ...
- Mac 命令行安装mysql homebrew 安装mysql后,如何配置mysql
非常好 强力推荐 这个是我最新并且一直推崇的方法:1.安装:sunyichaodeMacBook-Pro:~ sunyichao$ brew install mysql2.开启mysql:mysql. ...
随机推荐
- 在已经部署svn 服务器上,搭建svn项目 成功版
1.进入svn目录,建立版本库 svnadmin create svntest svntest为svn项目名称 2. hooks/ 目录下新建 post-commit 文件 [钩子脚本] #!/bin ...
- 进军VR虚拟现实-先来全景智慧城市-有梦想的互联网创业者
随着VR的大火,越来越多的企业开始进军VR行业,不过并不是所有企业进军VR行业都是成功的,那么问题来了,VR虚拟现实行业投资怎么做才能取得成功呢?这是当下很多企业面临的一个问题,VR虚拟现实行业投资也 ...
- Linux如何安装VMware Tools
第一步:安装VMware Tools 桌面上会出现一个光盘,并且会弹出一个框框,里面是VMware Tools的安装包,将其拖到桌面上 就像下面这样 进入终端,将文件拷贝到/tmp目录下面,并解压(也 ...
- TensorFlowSharp入门使用C#编写TensorFlow人工智能应用
TensorFlowSharp入门使用C#编写TensorFlow人工智能应用学习. TensorFlow简单介绍 TensorFlow 是谷歌的第二代机器学习系统,按照谷歌所说,在某些基准测试中,T ...
- Linux_破解密码-营救模式
实验用机:CentOS 5.7 破解密码 设置开机启动界面 系统运行级别 营救模式 一.破解密码 root用户可以更改任何用户的密码,普通用户只能修改自己的密码. 步骤: 1.重新启动系统 2.开机倒 ...
- python中的JSON(1)
很多程序都要求用户输入某种信息, 例如: 让用户存储游戏首选项或提供要可视化的数据,程序把用户的信息存储在列表和字典等数据结构中, 用户关闭程序时,我们几乎总要保存他们提供的信息: 如何保存-- ...
- Intel CPU命名规则的简略解析
Intel的CPU命名规则一直不是特别清楚,而网上的很多解读是不准确,甚至是错误的,应该以官方文档为准.所以我在查阅官方资料的基础上,以一种简明扼要的方式记录下来.值得说明的是,这个解析只是简略的,一 ...
- 【Netty】codec框架
一.前言 前面已经学习完了Netty框架中的主要组件,接着学习codec框架. 二.codec框架 每个网络应用程序必须定义如何将在对等体之间传输的原始字节解析并转换为目标程序的数据格式,这种转换逻辑 ...
- es6之Generator
1.Generator函数其实是一个封装了多个内部状态的状态机,执行它会返回一个遍历器对象,然后可以依次遍历Generator中的每一个状态,也就是分段执行,yield是暂停执行的标记,next恢复执 ...
- python爬虫从入门到放弃(三)之 Urllib库的基本使用
官方文档地址:https://docs.python.org/3/library/urllib.html 什么是Urllib Urllib是python内置的HTTP请求库包括以下模块urllib.r ...