Accessing the MySQL Command Line



Accessing the MySQL Command Line

MySQL has its own command line interpreter (CLI). You need to know how to access it to do very basic administration.

You can access the MySQL CLI using the mysql command followed by the -u option for the username and -p, which tells MySQL to prompt for a password. Here user root gains access:

     [root@bigboy tmp]# mysql -u root -p
     Enter password:
     Welcome to the MySQL monitor. Commands end with ; or \g.
     Your MySQL connection id is 14 to server version: 3.23.58

     Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

     mysql>

Note

Almost all MySQL CLI commands need to end with a semi-colon. Even the exit command used to get back to the Linux prompt needs one too!