mac使用brew安装mysql
1、安装mysql
#brew install mysql
报错
Error: The following directories are not writable by your user:
/usr/local/lib
You should change the ownership of these directories to your user.
sudo chown -R $(whoami) /usr/local/lib
意思是 您应该将这些目录的所有权更改为您的用户
执行以下命令设置权限
#sudo chown -R wuj /usr/local/lib
然后重新安装即可 brew install mysql
2、启动mysql服务
#mysql.server start
3、设置密码
通过brew安装后默认密码为空
执行以下命令设置密码
#mysql_secure_installation
Securing the MySQL server deployment.
Connecting to MySQL using a blank password.
VALIDATE PASSWORD COMPONENT 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 component?
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:
之后输入密码强度 0、1、2选择一个
因为手误我选择了1,但在后面设置密码时无法设置简单密码
Estimated strength of the password: 25
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
解决
更改密码强度为 LOW
先登录mysql
#mysql -uroot
设置validate_password_policy为0(表示等级low)
set global validate_password_policy=0;
执行会报错
ERROR 1193 (HY000): Unknown system variable 'validate_password_policy'
原因是 MySQL 5.7和MySQL 8.0版本变量名不同
validate_password_policy是在版本 MySQL 5.7中 存在 ,而 MySQL 8.0不存在
解决,执行以下命令查看密码验证插件
SHOW VARIABLES LIKE 'validate_password%';
Variable_name | Value |
+--------------------------------------+--------+
| validate_password.check_user_name | ON |
| validate_password.dictionary_file | |
| validate_password.length | 8 |
| validate_password.mixed_case_count | 1 |
| validate_password.number_count | 1 |
| validate_password.policy | MEDIUM |
| validate_password.special_char_count | 1
可以看到在mysql8.0中 变量名 为 validate_password.policy
好了,修改变量名后执行设置成功
set global validate_password.policy=0;
除此之外 ,还需设置密码长度(默认是长度8位以上)
set global validate_password.length=4;
解决以上问题后再次执行以下命令,设置密码即可
#mysql_secure_installation
4、mysql登录验证
#mysql -uroot -p
显示数据库
#show databases;
另:
在php连接数据库时报错,无法连接到数据库
The server requested authentication method unknown to the client
发现是因为mysql8.0版本的问题
打开mysql数据库 -》用户-》编辑root用户修改
修改插件 caching_sha2_password为 mysql_native_password即可
参考
https://blog.csdn.net/maxsky/article/details/51171474
https://blog.csdn.net/HaHa_Sir/article/details/80552663
mac使用brew安装mysql的更多相关文章
- Mac用brew安装MySQL
1.先安装brew 网址:https://brew.sh/ 复制命令:/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent ...
- mac使用brew安装mysql报RROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
使用mac安装mysql安装完后运行 mysql -uroot -p 报了 ERROR 2002 (HY000): Can't connect to local MySQL server throug ...
- 【MySQL】Mac通过brew安装的MySQL重启方法
问题 在 Mac 上通过 brew install mysql 安装的的MySQL使用基本MySQL命令重启会失败: mysql.server stop mysql.server start mysq ...
- Mac下brew安装与配置mysql
一.打开mac控制台 $ brew install mysql 二.启动mysql服务 $ mysql.server start 三.初始化mysql配置 1 rainMacBook-Pro:~ co ...
- Mac通过homebrew 安装mysql
来源:http://timtang.me/blog/2011/12/07/mac-homebrew-mysql/ 使用MBP有一年了,开始想在工作中使用mac由于各种不习惯最终失败,导致自己使用了一年 ...
- Mac OS下面安装mysql以及mysql常用命令
使用brew安装mysql brew install mysql 安装成功后使用下面命令启动/关闭服务 brew services start mysql brew services stop mys ...
- mac brew安装mysql
mac不自带mysql,这里需要重新安装,方法依然很简单 brew install mysql unset TMPDIR mysql_install_db --verbose --user=`whoa ...
- Mac中使用brew安装mysql
若不考虑版本直接执行以下命令 brew install mysql 若要选择版本只要加上@版本即可,例如 brew install mysql@5.7 安装完后启动mysql mysql.server ...
- mac环境下安装mysql
一,下载mysql 官网"Community " 下会看到"MySQL Community Server"下方有一个"download"点击 ...
随机推荐
- 全渠道java b2b b2c o2o平台
大型企业分布式互联网电子商务平台,推出PC+微信+APP+云服务的云商平台系统,其中包括B2B.B2C.C2C.O2O.新零售.直播电商等子平台. 根据微服务化设计思想,结合spring cloud一 ...
- SpringMVC Controller中注入Request成员域和在方法中定义中HttpServletRequest有啥区别
先说结论,在Controller中注入Request是线程安全的. 以下是解释: 我们先来看看这两者有什么不同 在controller注入成员变量request 可以看到注入的是一个代理对象 写在方法 ...
- W5100S芯片特性
W5100S是一款硬连线TCP / IP嵌入式以太网控制器,可使使用SPI(串行外设接口)和并行系统的嵌入式系统更容易实现互联网连接 W5100S适合需要稳定的Internet Connectivit ...
- LOJ-10105(欧拉回路模板,套圈法,递归)
题目链接:传送门 思路: (1)用邻接表存储有向图和无向图,有向图和无向图的每条边均站两个单元,无向图有正向边和反向边的区分. (2)有向图有欧拉回路:所有点的入度=出度: 无向图有欧拉回路:所有点的 ...
- async/await让你的代码更加优雅
一. 回调地狱:回调函数里面嵌套着回调函数嵌套着回调函数”,这就是被传说中的“回调地狱callbackHell () { const api = new Api() let user, friends ...
- thinkphp 5.1 同时选中多个文件上传
<form id="ajaxform" enctype="multipart/form-data" class="form"> ...
- Unity3D中声音播放
Unity3D 播放声音需要使用 Audio Source 组件,并且需要 Audio Listener 组件配合,不然无法听到声音.Main Camera 会默认有 Audio Lisetener. ...
- noip第13课资料
- [smf]论坛实现编辑器附件插入的插件
smf论坛代码的相关介绍,可以参见博客园的其他文章,这里不再详细说明了. 插件功能: 在帖子里的任何位置插入附件图片. 关于安装: 该插件已经经过“维尼熊的百宝箱”的修改,在新版本SMF 2.0.14 ...
- Django Model 进阶
回顾: 定义 models settings.py激活app才能使用models migrations:版本控制,当更改库表结构时可以处理数据 增删改查 常见Field 模型的价值在于定义数据模型,使 ...