当我是root的时候,“mysql”连接时没有密码,即使我已经设置了一个

当我是root的时候,“mysql”没有密码连接,即使我设置了一个:

# mysqladmin -u root password 'whatever' # mysql -u root -p Enter password: (typing the 'whatever' above) Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 4 to server version: 4.1.22-standard Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> Bye 

但不幸的是,这也发生了…

 # mysql -u root Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 25 to server version: 4.1.22-standard Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> 

所以即使我已经设置了密码,并且在使用“-p”的时候检查过,但是没有必要!!!?

编辑 :这是我的.my.cnf,里面有login密码。 删除它,一切OK。

也许你在〜/ .my.cnf里有用户凭据

  [客户]
用户=约翰
密码=史密斯 
 mysql> update user set plugin='' where User='root'; mysql> flush privileges;