How to Access the MySQL via Shell

From Brian Nelson Ramblings
Jump to: navigation, search

How to Access MySQL via the Shell/CLI

mysql is a simple SQL shell with input line editing capabilities. It supports interactive and noninteractive use.

Now that you have installed MySQL/Percona the first thing you will need to learn is how to access the mysql command line interface.

Access MySQL Prompting for Password

If you want to be prompted for your password(yes you do) run:

mysql -u <user> -p

Access MySQL without Prompting for Password

But if you want to toss security to the wind, you can use

mysql -u <user> -p<password>

Now you are in, if this is the first time you have accessed mysql, you will not need to input a password.

But I do recommend setting a password.