首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往
您找到你想要的搜索结果了吗?
是的
没有找到

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错误 #1.停止mysql数据库 /etc/init.d/mysqld stop  #2.执行如下命令 mysqld_safe --user=mysql --skip-grant-tables --skip-networking &  #3.使用root登录mysql数据库 mysql -u root mysql  #4.更新root密码 mysql> update user set authentication_string=password('root') where user='root'; #5.刷新权限  mysql> FLUSH PRIVILEGES;  #6.退出mysql mysql> quit  #7.重启mysql /etc/init.d/mysqld restart  #8.使用root用户重新登录mysql mysql -u root -p

01
领券