Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

pbutry

macrumors newbie
Original poster
Mar 2, 2017
1
0
Hi all,

I am learning php/sql coding and would like to manage database within Shell/Command line on Mac but cannot find mysql client on it. Does OSX comes with it pre-built? How do I run it? I have got MySQL database on remote server (gearhost.com) and would like to access it from within command line.

Thank you,
 

superscape

macrumors 6502a
Feb 12, 2008
937
223
East Riding of Yorkshire, UK
Hi all,
I am learning php/sql coding and would like to manage database within Shell/Command line on Mac but cannot find mysql client on it. Does OSX comes with it pre-built? How do I run it? I have got MySQL database on remote server (gearhost.com) and would like to access it from within command line.
Thank you,

I think you need to install it:

https://dev.mysql.com/doc/mysql-osx-excerpt/5.7/en/osx-installation.html

Personally I prefer to use Sequel Pro for many things though.

https://www.sequelpro.com

Good luck!
 

mkelly

Cancelled
Nov 29, 2007
207
218
No. macOS does not include the command-line MySQL client. As superscape says, you'll have to install it. You can do that one of several different ways:

  1. Install MySQL via Homebrew: https://brew.sh/
  2. Install a "MAMP" package like the one Bitnami provides. This includes MySQL, Apache and PHP so it sets up a nice little web development environment for you: https://bitnami.com/stack/mamp - note that after it's installed, you'll need to add the Bitnami application directory to your shell's PATH in order to get the "mysql" command to work on the command line.
  3. Install the MySQL package from the MySQL website (per the link in superscape's post above)
  4. Use a GUI client like Sequel Pro.
Note that options 1-3 will also install a functioning MySQL database server on your local computer which you may find useful for testing & educational purposes. Option 4 is the easiest way to connect to a remote server, but you're going to miss out on getting your hands dirty on the command line (which is actually a good thing to learn).

Nothing says you can't do one of 1-3, and still install Sequel Pro - which is normally how I set up my dev environments. It's nice to have a local server, command line tools, *and* a GUI.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.