Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

mysql

macos

xampp

I've got a vanilla install of XAMPP in OS X. How can I access the mysql command line tool? I've tried typing "mysql" at the command line, and it spits back "-bash: mysql: command not found".

like image 836
Jim Avatar asked Jul 28 '10 14:07

Jim


People also ask

How can I access the MySQL command line with XAMPP?

To access SQL via the command line we simply navigate to the xampp folder. the folder is usually on the c:\ drive. type: cd c:\xampp\mysql\bin then press enter. type: in mysql -u root -p then press enter.

How do I access my XAMPP database on Mac?

Go to your XAMPP folder, wherever you set it up during installation (Applications is the default), and then to the xamppfiles folder, and then phpmyadmin. Once you open up phpmyadmin, find the file config. inc.


2 Answers

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.

like image 171
Pablo Santa Cruz Avatar answered Oct 06 '22 00:10

Pablo Santa Cruz


  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!!

like image 20
Kumi Yare Avatar answered Oct 06 '22 01:10

Kumi Yare