How can I access the mysql command line tool when using XAMPP in OS X?

隐身守侯 提交于 2019-11-29 20:28:35

XAMPP is installed in Mac OS X in the following directory:

/Applications/XAMPP/

You can look what's inside that directory and run mysql command line tool providing the full path to it:

$ /Applications/XAMPP/xamppfiles/bin/mysql

If you need, you can modify your PATH environment variable to include XAMPP binaries and you won't need to specify the whole path all the time.

Kumi Yare
  1. Open your .profile file in Mac. This can be done by entering the terminal and typing

    pico ~/.profile
    
  2. Add the following line to your ./profile file. Replace the path where you installed Xampp, however by default this is the route and should work:

    export PATH=/opt/local/bin:/opt/local/sbin:/Applications/xampp/xamppfiles/bin:$PATH
    
  3. Open a new terminal window (Recommendation is to quit all terminal windows and then reopen) and type:

    mysql
    

That is all, isn't easy!!

Before using the mysql command, make sure that you start up the server first by running

$ mysql.server start

Then you will be able to use the commands mysqladmin and mysql.

To shut it down, run

$ mysql.server stop

and to restart just use

$ mysql.server restart

Very intuitive.

Mahabub Rahman

Open terminal and Follow this bellow step to add mysql to your mac environmental variable

step 1:

sudo nano ~/.bash_profile

step 2:

export PATH=/opt/local/bin:/opt/local/sbin:/Applications/xampp/xamppfiles/bin:$PATH

save it by control+x and then y and hit return. That's it!! now close the terminal and reopen

mysql --version

this will tell you which MySQL version you are using with xampp

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