MacOS Mojave[版本10.14.4] 用home-brew 下载mysql 全记录

一、安装homebrew

homebrew是macOS缺失的软件包管理器,譬如可以下载mysql、maven等等。

安装方法:

/usr/bin/ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”
将以上命令粘贴至终端。
homebrew更多详情请查看官网: https://brew.sh/index_zh-cn.html

二、安装mysql
$ brew instal mysql
在这里插
其中运行mysql_secure_installation 可以设置密码

运行brew service start mysql 可以后台启动mysql

运行mysql.server start 前台启动mysql(关闭控制台,服务停止)
三、下载完成后启动mysql

$ mysql.server start
在这里插入图片描述
四、更改密码

mysql_secure_installation

在这里插入图片描述**
下面的内容除了写密码,其它全部选y也不会有太大的问题
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: 1(选择密码强度等级)
等级1的密码组成为:数字、混合大小写和特殊字符
Please set the password for root here.

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!

五、登陆

mysql -u root -p

在这里插入图片描述
六、退出

mysql>quit;

在这里插入图片描述
最后注意一点:
如果提示权限问题使用sudo指令,我的笔记本上如果不加此指令各种权限问题

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值