Question

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').

Was it helpful?

Solution

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

OTHER TIPS

You can also add this to your a bash_profile so you don't have to write /Applications/MAMP/Library/bin/mysql each time by running in terminal :

sudo vi ~/.bash_profile

and adding

alias mysql="/Applications/MAMP/Library/bin/mysql"

Then, from terminal you can run : mysql -uroot -proot notice theres no space for this to work.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top