问:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
初次安装mysql,net start mysql,然后输入mysql -u root -p,出现enter password,我直接点击回车,结果出现如果下错误:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)。网上看了很多方法,都是千篇一律的,没有解决我的问题,有那个好心人能够帮助我 使用:set password for 'root'@'localhost' =password(''); flush privileges; 还是不行,当输入set password for 'root'@'localhost' =password('');时就出现no database seleced错误
注:我没有添加新用户,好像mysql有个默认的用户root,是不是我应该自己添加个新用户啊
答:
打开mysql中的my.ini(如果没有就将my-default.ini复制一份,并修改为my.ini);在[mysqld]下添加skip-grant-tables;重启mysql,在dos页面输入mysql,按enter即可
源网址:
http://zhidao.baidu.com/link?url=5S_cb29BF9hoCnxsAf7DZ5wKicLGd2OncWGDyl-jtVVTLYh5f3iHai0qKg70r39Jr3JlGeRumtJnKlhcxX0TLGcf4i0303kGHwD5WWlGebi