dongzao3923 2017-06-17 15:01
浏览 220

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 13: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).

    评论
  • dtu11716 2017-10-29 21:35
    关注
    1. Start MAMP

    The MySQL server must be running to change the password, open and start MAMP now. keep it running until the end of this.

    1. Mac Terminal

    With the MySQL server running, open the terminal (located in '/Applications/Utilities') enter or copy/paste the following:

    /Applications/MAMP/Library/bin/mysqladmin -u root -p password
    

    You'll be prompted for a password. Enter the current password for the root user. If you changed it in phpMyAdmin, use that password.

    Mosty password is blank so just press Enter and Enter Your New Password.

    $ /Applications/MAMP/Library/bin/mysqladmin -u root -p password
    Enter password:
    
    $ /Applications/MAMP/Library/bin/mysqladmin -u root -p password
    Enter password: 
    New password: 
    Confirm new password:
    

    Now You Have to make changes in some file:

    You need to replace all occurrences of the old root password with the new one you just created. To keep it easy here is a list of the files, you can open them in your favorite text editor and search for 'root', changing '-proot' to '-p NewPassword', replacing 'NewPassword' with your own.

    • /Applications/MAMP/bin/phpMyAdmin/config.inc.php
    • /Applications/MAMP/bin/checkMysql.sh
    • /Applications/MAMP/bin/quickCheckMysqlUpgrade.sh
    • /Applications/MAMP/bin/repairMysql.sh
    • /Applications/MAMP/bin/stopMysql.sh
    • /Applications/MAMP/bin/upgradeMysql.sh

      Stop and restart MAMP

    I hope that works/make sense because this works for me.

    展开全部

    评论
  • dongxuxian1123 2018-02-28 02:12
    关注
    1. Go to MAMP dashboard and Click on MySQL tab.
    2. There button called "Change password for user "root":
    3. Click on the button and change it.
    4. Thats it.
    评论
  • dtoka218420 2018-06-05 09:44
    关注

    If I were you, I would just take your htdocs folder and just reinstall mamp. I've had this issue occur installing wordpress locally, setting the config file with a db user without a password, and then changing the password after the config was created in the installation process. I don't know why I did this but this installed wordpress with a user without a password, when the database required a password, so it then was giving me an authentication error.

    评论
编辑
预览

报告相同问题?

悬赏问题

  • ¥20 为什么很少有分析折叠共源共栅放大器的psrr的资料,想分析,怎么入手
  • ¥25 完成Python任务
  • ¥15 java应用无法获取nacos导入的yml文件配置
  • ¥15 群晖域名解析到127.0.0.1
  • ¥15 mr_keep全是FALSE,但找不出来问题在哪
  • ¥15 电脑成服务器了怎么处理
  • ¥15 Ubuntu18.04怎样远程链接
  • ¥15 编译原理while语句翻译
  • ¥15 GO富集分析设置数据库
  • ¥15 vs软件出错,重装无效
手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部