如何在Mac下搭建MySQL环境

技术如何在Mac下搭建MySQL环境小编给大家分享一下如何在Mac下搭建MySQL环境,希望大家阅读完这篇文章之后都有所收获,下面让我们一起去探讨吧! 方法一:用dmg镜像安装1、安装官网下载

边肖想和大家分享一下如何在Mac下搭建MySQL环境。希望你看完这篇文章后有所收获。让我们一起讨论一下。

方法一:用dmg镜像安装

1.安装。

官网下载MySQL Mac安装包,按常规步骤安装。在安装过程中,将出现以下提示:

2019-03-24t 18:27:31.043133 Z1[注]atemporarypasswordsgenerated foroot @ localhost : dfrm 19!O0Xi,其中TdfRm19!O1是初始密码,最好先记住!

2.着陆。

在终端命令行上登录mysql:

$mysql-uroot-p

#输入上述密码。如果此步骤提示未找到: bash : MySQL :命令,请执行以下两个命令来建立软连接:

cd/usr/local/bin

ln-fs/usr/local/MySQL-8 . 0 . 11-MAC OS 10.13-x86 _ 64/bin/MySQL 3。更改密码。

在MySQL8.0.4之前,执行SET PASSWORD=PASSWORD(新密码)。但是新版本不能这样改,因为密码认证改了。具体步骤请参考https://blog.csdn.net/yi247630676/article/details/80352655。

方法二:用 Homebrew 进行安装

众所周知,Mac可以由家酿安装管理,非常方便。如果没有安装自制软件,你可以点击https://brew.sh/安装。

以下是mysql的安装方式。

$brewinstallmysql#安装指定的版本:brewinstallmysql@1.1.1下一步,只需等待。在以下文本出现后,我们已经知道我们需要做什么:

==mysql

我们在没有root password . to securetrun :的情况下安装了MySQL数据库

mysql_secure_installation

MySQL isconfiguredtoonlyallowconnections omlocalhostby default

to connectctrun :

mysql-uroot

to avelaunchdstartmysql nownandrestartatlogin :

brewservicesstartmysql

或者,如果您不想/需要backgroundserviceyounjustrun :

Mysql.serverstart按照描述继续并执行初始化操作:

在初始化$myysql_secure_installation的过程中会出现很多问题。以下是具体问题,用注释说明:

e class="brush:php;toolbar:false">Would you like to setup VALIDATE PASSWORD component?
Press y|Y for Yes, any other key for No: Y   ## 回复y 需要密码8位以上,回复n 则不做限制
The password validation component is not available. Proceeding with the further steps without the component.
Please set the password for root here.
New password:   ## 设置你的密码
Re-enter new password:   ## 再次输入你的密码
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    ## 是否移除匿名用户。考虑安全我选了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.
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : Y   ## 是否允许远程连mysql 的 root。我用做本地调试,不是远程服务器,所以y了
Success.
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.
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : Y      ## 是否y了删除test数据库,我选了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      ## 选y, 重新加载权限列表
Success.
All done!

到此配置就结束了,下面我们启动 mysql 即可,记住以下命令:

$ mysql -u root -p   ## 登陆 mysql
$ brew services start mysql@5.7   ## 启动 mysql
$ brew services stop mysql@5.7   ## 停止 mysql
$ mysql.server start   ## 启动 mysql(无后台服务)

看完了这篇文章,相信你对“如何在Mac下搭建MySQL环境”有了一定的了解,如果想了解更多相关知识,欢迎关注行业资讯频道,感谢各位的阅读!

内容来源网络,如有侵权,联系删除,本文地址:https://www.230890.com/zhan/54422.html

(0)

相关推荐

  • sqliteinsert影响什么(sqliteupdate和insert性能)

    技术SQLite中特殊的INSERT语句怎么用小编给大家分享一下SQLite中特殊的INSERT语句怎么用,希望大家阅读完这篇文章之后都有所收获,下面让我们一起去探讨吧!SQLite中特殊的INSERT语句在SQLite

    攻略 2021年12月18日
  • mac缩略图制作软件(mac图片编辑软件artstudiopro)

    技术电影缩略图制作工具Movie Thumbnails Maker for mac怎么用今天就跟大家聊聊有关电影缩略图制作工具Movie Thumbnails Maker for mac怎么用,可能很多人都不太了解,为了

    攻略 2021年12月24日
  • 746. 使用最小花费爬楼梯

    技术746. 使用最小花费爬楼梯 746. 使用最小花费爬楼梯数组的每个下标作为一个阶梯,第 i 个阶梯对应着一个非负数的体力花费值cost[i](下标从 0 开始)。
    每当你爬上一个阶梯你都要花费对应

    礼包 2021年10月26日
  • CF1588F Jumping Through the Array

    技术CF1588F Jumping Through the Array CF1588F Jumping Through the ArrayCF1588F Jumping Through the Arra

    礼包 2021年11月15日
  • 多分类任务中不同隐藏层层数对实验结果的影响

    技术多分类任务中不同隐藏层层数对实验结果的影响 多分类任务中不同隐藏层层数对实验结果的影响1 导入实验所需要的包 import torch
    import torch.nn as nn
    import nu

    礼包 2021年11月5日
  • 支付宝怎么交违章罚款,2021支付宝怎么交违章停车

    技术支付宝怎么交违章罚款,2021支付宝怎么交违章停车1、下载交管12123APP,用车主身份证注册,进去后可以看到车主身份证下所有车辆的情况支付宝怎么交违章罚款。按照说明一步步走下去就可以了。
    2、上支付宝,找到更多,

    生活 2021年10月22日