从命令行连接到MySQL [英] connecting to MySQL from the command line

查看:93
本文介绍了从命令行连接到MySQL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在Mac上从命令行连接到MySQL? (即,向我显示代码)

How can you connect to MySQL from the command line in a Mac? (i.e. show me the code)

我正在做一个PHP/SQL教程,但首先假设您已经在MySQL中.

I'm doing a PHP/SQL tutorial, but it starts by assuming you're already in MySQL.

推荐答案

请参见以上选项表示:

-u: username
-p: password (**no space between -p and the password text**)
-h: host
last one is name of the database that you wanted to connect. 

查看链接,那里有详细的链接!

Look into the the link, it's detailed there!

Rick 所述,您可以通过不输入密码来避免将密码作为命令的一部分传递像这样:

As already mentioned by Rick, you can avoid passing the password as the part of the command by not passing the password like this:

mysql -u USERNAME -h HOSTNAMEORIP DATABASENAME -p


人们正在编辑此答案:请不要在-pPASSWORD

这篇关于从命令行连接到MySQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆