MySQL Shell/Command line client for remote connections

Discussion in 'Mac Programming' started by pbutry, Mar 2, 2017.

  1. pbutry macrumors newbie

    pbutry

    Joined:
    Mar 2, 2017
    #1
    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,
     
  2. superscape macrumors 6502a

    superscape

    Joined:
    Feb 12, 2008
    Location:
    East Riding of Yorkshire, UK
    #2
    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!
     
  3. mkelly macrumors regular

    Joined:
    Nov 29, 2007
    #3
    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.
     

Share This Page