Mac使用终端安装并打开mysql [英] Mac install and open mysql using terminal
问题描述
我下载了mysql dmg文件并通过向导运行.完毕.我还已经在系统偏好设置下启动了mysql服务器.
I downloaded the mysql dmg file and went through the wizard to run. Done. I have also started mysql server under system preferences.
我这样做的目的是为了完成我的SQL课本的练习.终端命令对我来说是新手,但我认为一旦真正开始使用,就可以完成练习.
The purpose of me doing this is to work through the exercises of my SQL text book. The terminal commands are new to me but I think once I can actually get started, working through the exercises should be OK.
通过研究网络,各种博客告诉我导航到终端中的mysql文件夹: /usr/local/mysql
From researching the web the various blogs tell me to navigate to to the mysql folder in the terminal: /usr/local/mysql
好.然后,由于几乎每篇文章都对如何进行进行了一系列不同的说明,因此变得不太清楚.昨天我在摆弄它,并被提示输入密码-默认的mysql密码是什么?
Fine. Then it gets a little less clear as nearly each article has a different set of instructions on how to proceed. I was fiddling with it yesterday and was prompted for a password - what is the default mysql password?
有人可以给我一些通过终端启动并运行mysql的步骤吗?
Could someone give me the steps to get up and running with mysql via the terminal?
推荐答案
(2017年更新)
当您安装MySQL时,它将为root用户生成一个密码.您可以使用
When you installed MySQL it generated a password for the root user. You can connect using
/usr/local/mysql/bin/mysql -u root -p
并输入生成的密码.
以前,MySQL中的root
用户以前没有密码,只能从本地主机连接.因此,您将使用
Previously, the root
user in MySQL used to not have a password and could only connect from localhost. So you would connect using
/usr/local/mysql/bin/mysql -u root
这篇关于Mac使用终端安装并打开mysql的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!