ylm1989 2011-01-02 18:09
浏览 371
已采纳

Mysql cmd 登陆问题

用cmd方式登陆mysql
输入如下命令: [code="sql"]mysql -h localhost -u root -p root -D test[/code]
为什么总是返回 unknown database 'root' ?
如果用gui工具添加root数据库则能够登陆
如果不加-D 参数则也只在有root数据库时才能登陆。
看来-D 参数没有起作用。。。不知为何。。求各位指教

  • 写回答

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 license

    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

    mysql> exit;

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥100 有人会搭建GPT-J-6B框架吗?有偿
  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名