Connecting to MySQL from Command Line on macOS and Linux

Learn how to connect to MySQL from the command line under macOS (OSX) and Linux operating systems.

This video is from my online course SQL Beginner to Guru: MySQL Edition.

Checkout the full course here!


  1. Thanks for this, Mr. Guru. The solution works perfectly. But it is ephemeral, lasting only for the current shell session. I believe the alias has to go in the .bash_profile or .zsh file in one's home directory for it to persist, . Those files are for people using the bash or the Z shell, respectively. If you don't know what you're using–and it might be a surprise if you've updated your MacOS to Catalina–type echo $0 in the terminal. Then edit the appropriate config file. You can close the terminal window and re-open a new one, or type source .bash_profile or source .zsh to update the current shell instance. You should be all set from then on.