错误1045configurationmysql时

我可以安装MySQL,但configuration它时,我得到像这样的错误:** 1045:访问被拒绝用户root@loaclhost.**我可以安装它,我不能configuration它。 请帮助…我对此很新。

你是否为root用户指定了一个密码 – 默认情况下root用户没有pwd,所以如果你没有为root用户指定一个密码,你可以这样连接:

mysql -u root 

如果你指定了密码,你可以这样连接:

 mysql -u root -p (at which point you will get prompted for the password) 

如果你需要重置root的密码,你可以试试这个:

  1. 停止MySQL
  2. 使用skip-grant-tables选项手动重新启动它:mysqld_safe –skip-grant-tables
  3. 运行MySQL客户端:mysql -u root
  4. 用这个MySQL命令手动重置root密码:UPDATE mysql.user SET Password = PASSWORD('password')WHERE User ='root';
  5. 用这个MySQL命令刷新权限:FLUSH PRIVILEGES;

如果你创build一个单独的用户并且不使用root用于你的数据库操作(你不需要root的话)。