从命令行运行 MySQL
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17172359/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Running MySQL from command line
提问by Sood
I have very recently installed MySQL using Zend Server in an effort to learn PHP and MySQL.
我最近使用 Zend Server 安装了 MySQL,以学习 PHP 和 MySQL。
Installation went perfectly, however I installed it in my E: Drive as opposed to installing it in C drive. To launch it from the command line I am given to understand one must type, the following.
安装进行得很顺利,但是我将其安装在 E: 驱动器中,而不是安装在 C 驱动器中。要从命令行启动它,我必须了解必须键入以下内容。
"C:\Program Files\MySQL\MySQL Server 5.0\bin\mysqld" -u root
or some variant. In my case, mysqld
is in E:\Zend\MySQL55\bin
.
或某种变体。就我而言,mysqld
在E:\Zend\MySQL55\bin
.
However when I type in E:\Zend\MySQL55\bin\mysqld
, the command line freezes and I can no longer enter anything. If I simply open the .exe file from the folder it's in, a command prompt window opens up and in the same sense freezes and I can't access it.
但是,当我输入时E:\Zend\MySQL55\bin\mysqld
,命令行冻结,我无法再输入任何内容。如果我只是从它所在的文件夹中打开 .exe 文件,则会打开一个命令提示符窗口,并且同样会冻结并且我无法访问它。
Is there another way to open it or is what I'm doing close but slightly wrong?
有没有其他方法可以打开它,或者我正在做的事情接近但略有错误?
回答by Prasad Kharkar
For starting the server,
为了启动服务器,
C:\Program Files\MySQL\MySQL Server 5.0\bin\mysqld --console
To login, open a new command prompt window,
要登录,请打开一个新的命令提示符窗口,
C:\Program Files\MySQL\MySQL Server 5.0\bin\mysql -u root
Then it will ask for password and you can enter
然后它会要求输入密码,你可以输入
回答by Gilles V.
In fact, mysqld is the server. If you want to launch the client you have to call mysql
实际上,mysqld 是服务器。如果你想启动客户端,你必须调用mysql
C:\Program Files\MySQL\MySQL Server 5.0\bin\mysql -u root