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:
上面的命令应该花一些时间,然后打印如下内容:
You can now start the MySQL server by running:
1.现在,您可以通过运行以下命令来启动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.
2.现在我们需要保护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:
该过程可能会花费一些时间,但是它可以确保您可以立即获得最佳默认设置:
密码设置简单会一直提示让重复设置(注意)
Since we used brew services start mysql to start MySQL, your Mac will re-start it at reboot. You can run:
3.由于我们使用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:
4.您还可以通过运行以下命令来避免此守护程序模式 (这就是我们始终在后台运行并在计算机重新启动时重新启动的程序):
mysql.server start
This will start MySQL and will keep it running until the computer is shut down, or until you run:
5.这将启动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:
6.现在,您可以使用以下命令连接到服务器:
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:
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:
上面的命令应该花一些时间,然后打印如下内容:
You can now start the MySQL server by running:
1.现在,您可以通过运行以下命令来启动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.
2.现在我们需要保护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:
该过程可能会花费一些时间,但是它可以确保您可以立即获得最佳默认设置:
密码设置简单会一直提示让重复设置(注意)
Since we used brew services start mysql to start MySQL, your Mac will re-start it at reboot. You can run:
3.由于我们使用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:
4.您还可以通过运行以下命令来避免此守护程序模式 (这就是我们始终在后台运行并在计算机重新启动时重新启动的程序):
mysql.server start
This will start MySQL and will keep it running until the computer is shut down, or until you run:
5.这将启动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:
6.现在,您可以使用以下命令连接到服务器:
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: