I have MAMP installed in my Applications folder on my Mac, and the project files inside the htdocs folder on MAMP.
If I want to connect to MySQL from the command line, what would I type into the command line?
Note, it says that to connect to MySQL from my scripts I need to use the following, but I’m not sure how it will look from the command line
Host localhost
Port 8889
User root
Password root
EDIT – after running sudo ps -aef | grep mysqld in my terminus, I got the following.
501 528 1 0 0:00.02 ?? 0:00.02 /bin/sh /Applications/MAMP/Library/bin/mysqld_safe --port=8889 --socket=/Applications/MAMP/tmp/mysql/mysql.sock --lower_case_table_names=0 --pid-file=/Applications/MAMP/tmp/mysql/mysql.pid --log-error=/Applications/MAMP/logs/mysql_error_log
501 598 528 0 0:00.77 ?? 0:03.72 /Applications/MAMP/Library/libexec/mysqld --basedir=/Applications/MAMP/Library --datadir=/Applications/MAMP/db/mysql --user=mysql --lower_case_table_names=0 --log-error=/Applications/MAMP/logs/mysql_error_log.err --pid-file=/Applications/MAMP/tmp/mysql/mysql.pid --socket=/Applications/MAMP/tmp/mysql/mysql.sock --port=8889
501 6083 4176 0 0:00.00 ttys000 0:00.00 grep mysqld
EDIT

working answer
$ mysql –host=127.0.0.1 –port=8889 –user=root -p
Enter password:
or
The default password for the mysql root account under MAMP is root, so when it prompts for the password, enter “root” (but don’t include the quotes). So, if you want to provide the password right on the main command line, versus prompting for it, do as follows: