MacOS – Cannot login to WordPress related MySQL database from iTerm

macosMySQLWordpress

I realized today I actually have two MySQL databases on my Mac OS X Sierra because when I log in to MySQL via iTerm, its not the same database as what I see via phpMyAdmin, but no matter what username or password I attempt from the user accounts in phpMyAdmin, I am unable to log in to that particular database even if I change the password to any of the users.

In this case I checked the wp-config.php in my WordPress core files for the database username and password, but I was not able to log in with those, which means those are not the correct credentials.

I realized after retracing my steps that those were the creds for the production database.

What I did not realize here is that I could have a MySQL database server via Homebrew and still have another MySQL database server via MAMP. I thought they would be one and the same server.

Best Answer

I figured it out reading the MAMP documentation. For anyone who may run into this in the future.

Just go to your iTerm and type:


/Applications/MAMP/Library/bin/mysql --host=localhost -uroot -proot

You should be able to successfully log in. The MAMP docs helped after I realized MAMP database server is independent of what gets installed with Homebrew.