用cmd方式登陆mysql
输入如下命令: [code="sql"]mysql -h localhost -u root -p root -D test[/code]
为什么总是返回 unknown database 'root' ?
如果用gui工具添加root数据库则能够登陆
如果不加-D 参数则也只在有root数据库时才能登陆。
看来-D 参数没有起作用。。。不知为何。。求各位指教
Mysql cmd 登陆问题
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
2条回答 默认 最新
- beneo 2011-01-02 19:39关注
抱歉,这个不是\h就能看到的
http://dev.mysql.com/doc/refman/5.0/en/mysql-command-options.html
或者在linux下面
[quote]$man mysql[/quote]你可以看到
[quote]The password to use when connecting to the server. If you use the
short option form (-p), you cannot have a space between the option
and the password.[/quote]
[color=red]password与-p之间不能有空格[/color]--database=db_name, -D db_name
The database to use. This is useful primarily in an option file.[quote]如果不加-D 参数则也只在有root数据库时才能登陆。
看来-D 参数没有起作用。。。不知为何。。求各位指教[/quote]不是的,你看
$ mysql -h localhost -u saarixx -psaarixx -D demo
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 54
Server version: 5.1.49-1ubuntu8.1 (Ubuntu)Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 licenseType 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> exit;
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报
悬赏问题
- ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
- ¥15 如何在scanpy上做差异基因和通路富集?
- ¥20 关于#硬件工程#的问题,请各位专家解答!
- ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
- ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
- ¥30 截图中的mathematics程序转换成matlab
- ¥15 动力学代码报错,维度不匹配
- ¥15 Power query添加列问题
- ¥50 Kubernetes&Fission&Eleasticsearch
- ¥15 報錯:Person is not mapped,如何解決?