How do i access mysql from mac terminal, using xampp?

ぃ、小莉子 提交于 2019-12-02 18:44:59

/Applications/xampp/xamppfiles/bin/mysql -u root -p

Worked like a charm!

Thanks to user: Wrikken!

I usually do this to activate php and mysql from terminal with XAMPP 1.7.3(and probably above) on Mac

 1. Go to Terminal
 2. Enter which php: If it says /usr/bin/php, then proceed to 3.
 3. Enter sudo nano ~/.bash_profile (or sudo vim ~/.bash_profile if you know how to use it)
 4. Then paste this export PATH="/Applications/XAMPP/xamppfiles/bin:$PATH"
 5. Ctrl - O then enter to save, then ctrl - X to exit.
 6. Type cd ~
 7. type . .bash_profile
 8. Restart terminal.
 9. Enter which php: If you did it right, it should be the same as the path in #4.
Zheng. Cheng

I'm just a new xampp user. I am also trapped by this question. Yes, the right directory is

/Applications/XAMPP/xamppfiles/bin/(the newest xampp is uppercase)

but when you connect to db, you should type

./mysql -u root -p (if there's password),

not input

mysql -u root -p...   

directly, it wordked successfully on my macbook pro.

Ignacio Ito
sudo /Applications/XAMPP/xamppfiles/bin/mysql.server start

I had to use open command for me to work.

e.x.

open /App/Applications/xampp/xamppfiles/bin/mysql

Nice feature on Mac is to open terminal and go to preferences. Hit profiles tab and create a new profile. under shell type the path to MySQL and enter in everything as you would when going the long way. Ex:

/Applications/XAMPP/xamppfiles/bin/mysql --user=root --password=

Just add your info on the path above. close the preference window and go to FILE and hit new window. Chose your profile. I named mine MySql. Thats it.

I used this to access phpmyadmin mysql database though terminal

/opt/lampp/bin/mysql -uroot -ppassword

then

USE dbname

if the xampp is install in your mac book just go the file path of cd /Applications/XAMPP/bin/

./mysql -u root -p

than it will ask for password if set than type else enter

mysql is started now !!!!!!!!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!