/Applications/MAMP/Library/bin/mysql --host=localhost -uroot -proot
Or
mysqld -u root -p
GRANT ALL PRIVILEGES ON *.* TO 'username'@'localhost' IDENTIFIED BY 'password';
/Applications/MAMP/Library/bin/mysql --host=localhost -usample -psample
Add below code to ~/.zshrc
export PHP="/Applications/MAMP/Library/bin:/Applications/MAMP/bin/php/php7.3.7/bin:$PATH"
To check it, type in terminal
which php
which mysql
which mysqld
Each one of those commands should return the path of MAMP php, mysql, or mysqld
/Applications/MAMP/bin/php/php7.3.7/bin/php
/Applications/MAMP/Library/bin/mysql
/Applications/MAMP/Library/bin/mysqld
Ensure php version is the same as php version selected in MAMP settings
php -v
mysql --version
mysqld --version
Example usage on dbeaver.
- Stop any available MAMP's services: apache, mysql, memcached, etc
- Stop apache service from terminal
sudo apachectl stop
- Change mysql ports in MAMP to 3306
- Save, start MAMP's servers
- In terminal, type
sudo apachectl restart
- Done, try connect to mysql on dbeaver using port 3306
Happy hacking!