I’m working on a Mac with MAMP installed and trying to establish a database connection using the mysqli_connect() function. However, I keep getting this error message:
Access denied for user ‘root’@‘localhost’ (using password: YES)
I’m completely lost on where to locate my MySQL login credentials. I’ve searched through several forum discussions and some people mentioned checking a PHP configuration file at etc/phpmyadmin/config.inc.php, but I can’t seem to locate this file on my system. Could someone please guide me on where to find the correct username and password for my MySQL database connection?
Check your MAMP control panel – it displays the ports and basic information right on the main screen. The username is typically ‘root’, but if you’re still having trouble, you should look in /Applications/MAMP/bin/phpMyAdmin/config.inc.php; that’s where MAMP actually keeps its phpMyAdmin configuration on Mac. Additionally, verify your port number. MAMP uses MySQL on port 8889 instead of the default 3306, which means your connection should be mysqli_connect(‘localhost:8889’, ‘root’, ‘root’, ‘database_name’). I encountered a similar access denied error until I realized I was connecting to the wrong port. You can confirm the port in the MAMP preferences under the Ports tab.
MAMP’s default login is username ‘root’ and password ‘root’ - not blank like regular MySQL setups.
To double-check: open MAMP → click ‘Open WebStart page’ → Tools > phpMyAdmin. The login screen shows your current credentials.
Forgot your password? Reset it in MAMP preferences under the MySQL tab.
Honestly, local database connections are a pain. I used to waste hours on this stuff until I started using workflow tools for database operations.
Latenode handles all the connection management automatically - no hardcoded credentials or connection string headaches. Set up your database once in their interface and it manages authentication for you. Much cleaner than dealing with mysqli_connect().
I’ve dealt with MAMP issues like this before. Check /Applications/MAMP/conf/mysql/my.cnf for MySQL server config details. Sometimes it’s not about finding credentials - you might have MySQL service conflicts instead. Run ps aux | grep mysql in terminal to see if other MySQL processes are running and blocking MAMP’s instance. Kill those processes first, then restart MAMP. Also, MAMP Pro has different defaults than regular MAMP, so make sure you know which version you’re using. That ‘using password: YES’ error usually means your username’s right but the password authentication is failing.
I had the same MAMP issue when I started. You’re probably looking in the wrong spot - check /Applications/MAMP/bin/phpMyAdmin/config.inc.php for your database credentials. Or just fire up your MAMP servers and hit the start page to access phpMyAdmin directly. Default login is usually root/root, but you might’ve changed it.
Everyone gets hung up on credentials, but the real problem is manually managing all these database connections. Yeah, you can dig through MAMP settings and config files, but there’s a better way.
Don’t hardcode mysqli_connect() with credentials that’ll change. I handle database stuff through automation workflows instead. No more password hunting or port conflicts.
Set up database connections once in a workflow platform, then trigger operations with simple HTTP requests or events. The platform handles auth and connection pooling - MAMP credential changes won’t break your code.
This saved me tons of time debugging connection strings across different environments. When you go from local to production, everything works without touching a single line of database code.
Latenode makes this dead simple - configure your database once in their visual interface and build workflows that handle all the connection mess for you.
restart mamp and check the start page - it shows the mysql creds right there. still getting access denied? try connecting without a password first, mamp sometimes gets weird with root password setup. also make sure you’re using port 8889 for mysql, not 3306.