dongzao3923 2017-06-17 23:01
浏览 221

MAMP和PHPMyAdmin:#1045 - 用户'root'@'localhost'拒绝访问(使用密码:YES)[复制]

I have MAMP installed and I've never had a problem with it. Today I tried logging in to PHPMyAdmin and I got the following error message:

1045 - Access denied for user 'root'@'localhost' (using password: YES)

enter image description here

In my config.inc.php file, the following options are set:

$cfg['Servers'][$i]['auth_type']     = 'config';    // Authentication method (config, http or cookie based)?
$cfg['Servers'][$i]['user']          = 'root';      // MySQL user
$cfg['Servers'][$i]['password']      = 'root';

I've never changed my password. This is a local install, so I've always used 'root' for username and password.

I've tried accessing MySQL through the terminal:

/Applications/MAMP/Library/bin/mysql

But I get this:

ERROR 1045 (28000): Access denied for user 'boneill'@'localhost' (using password: NO)

Not sure what could have happened. I haven't changed passwords or anything like that. It just stopped working all of a sudden. Any ideas?

</div>
  • 写回答

4条回答 默认 最新

  • doupijin0397 2017-06-26 21:15
    关注

    Taking into consideration that you seem to have trouble debugging the issue, I think the most easiest way to rule out some of the probabilities is to install:

    MySQL Workbench

    It's free and you can use it as a GUI to try logging in to "localhost" or better "127.0.0.1" port 3306, user "root", password as you've chosen.

    If you still notice an error connecting to the database, go to control panel -> services and check the status of the MySQL database. It might have crashed. Try to restart the service. If it shuts down again immediately, check your disk space. If you are running low on disk space, tables might have got corrupted. Also, check your firewall rules. If you are working in a corporate environment, somebody may have deployed new security polices - this might lead to port blocking, application networking issues etc. pp. -- even on your local host. Automatic windows updates might cause those changes too.


    If it works using MySQL workbench, you can rule out any issue on database side. You can focus on PHP / MAMP then. Check the version and if any update has been installed (probably automatically). Is php mysql module installed and configured (php.ini, ensure php mysql dll is loaded).

    评论

报告相同问题?