我用cmd进入mysql通常情况下是:
mysql -u root -p
然后提示输入密码
进入如下界面C:\Documents and Settings\Administrator>mysql -u root -p
Enter password: ****
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2 to server version: 5.0.19-ntType 'help;' or '\h' for help. Type '\c' to clear the buffer.但是现在我进入cmd直接输入mysql然后就进入了C:\Documents and Settings\Administrator>mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4 to server version: 5.0.19-ntType 'help;' or '\h' for help. Type '\c' to clear the buffer.mysql>这是什么原因,这不就没有安全性了吗,还是我哪里设置有问题?

解决方案 »

  1.   

    你可以 select user, host from mysql.user; 看看有没有 user 为空的用户,另外这个用户一般是指定 localhost 的,所以只有本机可以登录。如果觉得危险,删掉这样的用户就行了呗。
      

  2.   

    检查 用户是否设置密码
    SELECT * FROM mysql.user;
    or
    SELECT USER();
      

  3.   

    你直接 show grants 看一下就明白了。你使用应该是默认的用户名。
      

  4.   

    你的密码在配置文件里面写好了  找到my.ini  然后看[clicent] 是否有passwd项
      

  5.   


    mysql> select user,host from mysql.user;
    +------+-----------+
    | user | host      |
    +------+-----------+
    |      | %         |
    | root | %         |
    |      | localhost |
    | root | localhost |
    +------+-----------+
    4 rows in set (0.05 sec)内容如下
    怎么解释啊,是有一个是空的?
      

  6.   


    mysql> select password from mysql.user where user='root';
    +-------------------------------------------+
    | password                                  |
    +-------------------------------------------+
    | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
    | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
    +-------------------------------------------+
    2 rows in set (0.02 sec)这样搜索如下内容,应该是root用户的密码就是root
    不过为什么有了两条记录呢?
      

  7.   

    | Grants for @localhost
                            |
    +-------------------------------------------------------------------------------
    --------------------------------------------------------------------------------
    --------------------------------------------------------------------------------
    ------------------------+
    | GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS,
     FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES,
     LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO ''@'local
    host' WITH GRANT OPTION |
    +-------------------------------------------------------------------------------
    --------------------------------------------------------------------------------
    --------------------------------------------------------------------------------
      

  8.   

    不是很理解上面输出的内容和允许任何登录,
    现在如果我用MySQL Command Line Client登录的话,必须输入root才能登录
    但是用cmd登录就不用,同时用cmd登录的时候输入root或者是不输入都能登录
    麻烦您了