Hướng dẫn mamp reset mysql password

I changed my root level password on phpMyAdmin. I was unsure where to enter the password itself, as it did not give me the option [login form]. I wondered if it was the php.ini file but users with read privileges could read it if I placed the password in there.

Now, the mysql doesn't run as I tried various online resources to fix the problem. If needs be I would delete mamp and re-install but I do not want to lose my database files. Ideally I would revert the password to default, which I believe was nothing, except now I cannot connect to phpmyadmin, or the mamp start page:

Error: Could not connect to MySQL server!

Any help would be great.

UPDATE -

Error message from mamp:

/Applications/MAMP/Library/bin/mysqlcheck: Got error: 1045: Access denied for user 'root'@'localhost' [using password: YES] when trying to connect

asked Apr 15, 2013 at 14:46

m33bom33bo

1,2921 gold badge15 silver badges33 bronze badges

This seemed to have fixed it when using terminal to reset the password:

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

Found on mamp faq.

answered Apr 15, 2013 at 15:52

m33bom33bo

1,2921 gold badge15 silver badges33 bronze badges

0

Look in the files:

  • checkMysql.sh
  • quickCheckMysqlUpgrade.sh
  • repairMysql.sh
  • stopMysql.sh

The important one in this case is "quickCheckMysqlUpgrade.sh". All the files are located in the /Applications/MAMP/bin/ directory.

In these files you'll find something like

# /bin/sh
/Applications/MAMP/Library/bin/mysqlcheck --quick --check-upgrade -u root -proot --socket=/Applications/MAMP/tmp/mysql/mysql.sock mysql

When you see -proot that is the password MAMP will try to use, -p{password}.

-p means "password" and whatever comes after is the password. So change "-proot" to eg. "-pmysecret" or whatever your password is.

answered Oct 1, 2014 at 12:54

I was being annoyed by the startup "access denied" error MAMP would show, even though I was able to access my site using phpMyAdmin or other SQL tools. I even found/updated the password in checkMysql.sh, repairMysql.sh, and upgradeMysql.sh. I did not notice the script called quickCheckMysqlUpgrade.sh and correcting the password in that fixed the startup error for me.

answered Aug 27, 2016 at 14:02

Rich RRich R

911 gold badge1 silver badge6 bronze badges

I just solved this issue on my MBP! In MAMP Pro [v352], go to the MySQL tab and press "Change Password".

answered Sep 24, 2017 at 5:36

1

FAQ

How do I change the password of the MySQL root user?

  1. Open the macOS Terminal Application located in your “/Applications/Utilities” directory.
  2. Enter the following command line:
    /Applications/MAMP/Library/bin/mysqladmin -u root -p password [NewPassword]
  3. Replace [NewPassword] with your new password.
  4. Please bear in mind that you also have to change the phpMyAdmin configuration and probably your own PHP scripts to use the newly created MySQL password. For changing the phpMyAdmin configuration edit the following file and update the password.
    “/Applications/MAMP/bin/phpMyAdmin/config.inc.php”

phpMyAdmin là công cụ quản lý hệ quản trị CSDL MySQL nền web phổ biến. Thông thường các phần mềm Web như MAMP,… đều hỗ trợ phpMyAdmin tuy nhiên chúng chưa chắc lại là bản mới nhất. Vậy bạn muốn sử dụng bản phpMyAdmin cho riêng mình thì bạn nên tham khảo hướng dẫn sau đây.

Bước 1: Tải bản phpMyAdmin mới nhất từ trang chủ phpmyadmin.net

Bước 2: giải nén và sửa tên thư mục thành phpmyadmin

Bước 3: Copy thư mục phpmyadmin vào thư mục root của web server.

VD: trên MAMP thì thư mục root mặc định nằm ở đường dẫn /Applications/MAMP/htdocs/

Bước 4: Truy cập vào thư mục phpmyadmin, copy file config.sample.inc.php sang config.inc.php

Bước 5: Sửa file config.inc.php và sửa các config như sau:

Chủ Đề