macosx 安装mysql_macos 安装mysql_如何在macOS上安装MySQL

macos 安装mysql_如何在macOS上安装MySQL

macos 安装mysql_如何在macOS上安装MySQL

macos 安装mysql

On macOS, you can install MySQL easily using Homebrew.

在macOS上,您可以使用Homebrew轻松安装MySQL。

Run:

跑:

brew install mysql

The above command should take a while, then print something like this:

上面的命令应该花一些时间,然后打印如下内容:

Screen%20Shot%202019-12-17%20at%2019.23.24.png

You can now start the MySQL server by running:

现在,您可以通过运行以下命令来启动MySQL服务器:

brew services start mysql

Now we need to secure the MySQL server. By default the server comes without a root password, so we need to make sure it’s protected.

现在我们需要保护MySQL服务器。 默认情况下,服务器没有root密码,因此我们需要确保它受到保护。

Run:

跑:

mysql_secure_installation

The procedure can take a while, but it gives a lot of power to make sure you get the best defaults out of the box:

该过程可能会花费一些时间,但是它可以确保您可以立即获得最佳默认设置:

Screen%20Shot%202019-12-17%20at%2019.27.14.png

Since we used brew services start mysql to start MySQL, your Mac will re-start it at reboot. You can run:

由于我们使用brew services start mysql来启动MySQL,因此Mac将在重新启动时重新启动它。 您可以运行:

brew services stop mysql

to stop this from happening, and also to immediately stop MySQL.

以阻止这种情况的发生,并立即停止MySQL。

You can also avoid this daemon mode (that’s what we call programs that always run in the background and restart when the computer is restarted) by running:

您还可以通过运行以下命令来避免此守护程序模式 (这就是我们始终在后台运行并在计算机重新启动时重新启动的程序):

mysql.server start

This will start MySQL and will keep it running until the computer is shut down, or until you run:

这将启动MySQL并保持其运行,直到计算机关闭或运行:

mysql.server stop

and it will not re-start it at reboot.

并且它不会在重新启动时重新启动它。

It’s up to you to decide which one you prefer.

由您决定要选择哪一个。

Now you can connect to the server using the command:

现在,您可以使用以下命令连接到服务器:

mysql -u root -p

You will need to type the root user password after you run this command, and once you are done you should see this screen:

您需要输入root在运行此命令后,用户密码,一旦你完成你应该看到这样的画面:

df955c45bbd3da7b6b46bb089bed41aa.png

A great GUI (graphical) software we can use to interact with a SQLite database is TablePlus.

TablePlus是我们可以用来与SQLite数据库进行交互的出色GUI(图形)软件。

It comes with a free trial that’s perfect for our usage, because it’s not time-based but rather it limits the amount of concurrent connections you can make to the database.

它带有一个免费试用版,非常适合我们的使用,因为它不是基于时间的,而是限制了您可以与数据库建立的并发连接的数量。

Download it from https://tableplus.com. I know there are macOS, Windows and Linux versions.

从https://tableplus.com下载。 我知道有macOS,Windows和Linux版本。

d2d7e7956180e7e79efe212c86efa57d.png

Click “Create a new connection…” and select MySQL in the list:

单击“创建新连接…”,然后在列表中选择MySQL:

2bef0ec6586249ec968753b355350a21.png

then set a name for the connection, and enter “root” and the password you set previously:

然后为连接设置一个名称,然后输入“ root”和您之前设置的密码:

c4002615a5a2f068b587ebf0a8e2defb.png

Click Connect, and you should be connected to MySQL!

单击“ Connect ,您应该已连接到MySQL!

a6c9929e1c87bcdf7416377a8b94ec7a.png

Note that we are connected using the root user, which should only be used for administration purposes.

请注意,我们使用root用户进行连接,该用户只能用于管理目的。

Day to day use of a database should be done using a normal user. We’ll see it in a separate tutorial.

日常使用数据库应该由普通用户完成。 我们将在单独的教程中看到它。

翻译自: https://flaviocopes.com/mysql-how-to-install/

macos 安装mysql

macos 安装mysql_如何在macOS上安装MySQL相关教程

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值