1.匿名用户是一个什么概念呢?为什么么安装后要有一个匿名用户呢?2.修改用户密码,以下两句都可以,请问有区别吗?哪种更好些,
好象是加密算法不一样吧,这应会导致 password字段的值最终会不同呀,那么mysql登录时,如何检测出这个password字段是用哪种方式加密的呢?update   user   set   password=password( "root ")   where   user= "root " 
update   user   set   password=md5( "root ")   where   user= "root " 

解决方案 »

  1.   

    还有,匿名用户就是 user='' 的用户吧,
    但是我如何用匿名用户登录呢?
    比如一般root用户是mysql -h localhost -uroot  -p1234
    但是匿名用户如何写代码呢?即如何表示匿名用户呢?
      

  2.   

    MYSQL安装完成后一般会自动创建下面这三个用户
    mysql> select user,host,password from mysql.user;
    +------+-----------+----------+
    | user | host      | password |
    +------+-----------+----------+
    | root | localhost |          |
    | root | 127.0.0.1 |          |
    |      | localhost |          |
    +------+-----------+----------+
    3 rows in set (0.00 sec)第三个可能就是你所指的 "匿名用户" 用户吧,在MYSQL的手册中并没有“匿名用户”这个术语。
    下面就是以这个 ''@localhost 用户登录MYSQL
    [code=BatchFile]C:\MySQL\mysql-5.1.47-win32\bin>mysql -u csdn
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 3
    Server version: 5.1.47-community MySQL Community Server (GPL)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> show grants;
    +--------------------------------------+
    | Grants for @localhost                |
    +--------------------------------------+
    | GRANT USAGE ON *.* TO ''@'localhost' |
    +--------------------------------------+
    1 row in set (0.05 sec)mysql>[/code]
      

  3.   

    你可以将这个用户删除。
    update   user   set   password=password( "root ")   where   user= "root "  
    update   user   set   password=md5( "root ")   where   user= "root "  第一句是正确的,第二句不对,你可以自己试一下就知道了。PASSWORD()是MYSQL自己的一种算法。
      

  4.   

    MySQL官方文档 http://dev.mysql.com/doc/refman/5.1/zh/index.html
      

  5.   

    update user set password=md5( "root ") where user= "root "  
    flush privileges
    这么写登陆不了
      

  6.   

    安装完Mysql之后,你可以将原来默认的所有用户删除了,然后自己给添加几个用户