maxedison maxedison - 9 days ago 6
MySQL Question

Access mysql for MAMP from command line

I have been learning Ruby on Rails and have been using the command line successfully to view and edit the database (using the

mysql
command).

I am now using MAMP and trying to install Wordpress. It appears that it is using a "different" mysql. I.e., databases I create via the command line aren't viewable in MAMP's phpmyadmin, and vice versa.

How can I access MAMP's mysql via the command line? I'm guessing that I need to specify the host when logging in with the
mysql
command, but I'm not sure what to put there. Since phpmyadmin exists at
localhost:8888/phpMyAdmin
, I tried using
mysql -h localhost:8888 -u root -p
, but that didn't work (error:
Unknown MySQL server host 'localhost:8888'
).

Answer

MAMP installs it's own MySQL which means that you now have two MySQL instances installed on you machine.

try typing this in your terminal

/Applications/MAMP/Library/bin/mysql