mysql数据库1045错误处理

来源:互联网 发布:飞信邮件群发软件 编辑:程序博客网 时间:2024/06/04 17:59

错误描述:解决MySql 数据库 提示:

1045 access denied for user 'root'@'localhost' using password yes

解决思路:

方法1:授予数据库用户最大权限

   update user set host='%' where user='root';

   flush privileges;

注意:在执行第一条语句会报错,继续执行第二条语句即可

方法2:插入用户到mysql 数据库下的user用户

insert into user(host,password,user)values ('localhost',password('oracle'),'root');

flush privileges;

授权:grant all on database.*to 'root'@'localhost';

注意:host为连接的数据库ip

          password为数据库密码,一般使用密文

          root为数据库用户,建议不使用root用户。

          database为连接的数据库名