Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I install command line MySQL client on mac?

People also ask

How do I Download and install MySQL from the command line client?

In case you don't have the client on your PC and you don't want to install the entire MySQL Server package, go to the MySQL download page, select the Microsoft Windows platform, and download Windows (x86, 64-bit), ZIP Archive. You will find MySQL Command Line Client binaries in the bin folder.

How do I Download MySQL for Mac terminal?

Visit https://dev.mysql.com/downloads/mysql and choose the MySQL version that you want to download. On this page, you will see list of operating systems under the “Select Operating System” dropdown choose the macOS from the list. Then, click on the download button for the MySQL . dmg file.


install MySQLWorkbench, then

export PATH=$PATH:/Applications/MySQLWorkbench.app/Contents/MacOS

If you have already installed MySQL from the disk image (dmg) from http://dev.mysql.com/downloads/), open a terminal, run:

echo 'export PATH=/usr/local/mysql/bin:$PATH' >> ~/.bash_profile

then, reload .bash_profile by running following command:

 . ~/.bash_profile

You can now use mysql to connect to any mysql server:

mysql -h xxx.xxx.xxx.xxx -u username -p

Credit & Reference: http://www.gigoblog.com/2011/03/13/add-mysql-to-terminal-shell-in-mac-os-x/


Best option is:

brew install mysql

This strictly installs a command line client, without the other overhead:

Install Homebrew (if you don't have it):

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Then, install mysql-client:

brew install mysql-client

Then, add the mysql-client binary directory to your PATH:

echo 'export PATH="/usr/local/opt/mysql-client/bin:$PATH"' >> ~/.bash_profile

Finally, reload your bash profile:

source ~/.bash_profile

Then you should be able to run mysql in a terminal, if not try opening a new terminal


Mysql has a client-only set of utilities:

Mysql client shell https://dev.mysql.com/downloads/shell/

Other command line utilities https://dev.mysql.com/downloads/utilities/

Mac OSX version available.


There is now a mysql-client formula.

brew install mysql-client


For installing mysql-shell with homebrew, run

brew cask install mysql-shell

you can then launch the mysql shell with

mysqlsh

if you want to enter SQL mode directly, run

mysqlsh --sql