> 数据库 > MySQL >

CentOS 下mysql ERROR 1045: Access denied for user: 'root@localhost' (Using password: NO)

每次启用mysql都出现这个问题
然后我键入命令# mysql -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 35 to server version: 4.0.20-standard

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>
这样才能用,不过想给mysql备份就不可以了,键入
#mysqldump database>databak.sql
就又出现RROR 1045: Access denied for user: 'root@localhost' (Using password: NO)
怎么才能接着键入mysql就能使用,而且能对mysql进行备份
2010-08-19 10:58

登陆mysql,然后执行下面语句:

set password for 'root'@'localhost' =password('');
flush privileges;

然后再重新登陆,就达到你的要求了. (责任编辑:IT)