1. Open a command shell and type: cd c:\mysql\bin (or on Linux: cd /usr/local/mysql/bin).
2. Type: mysql –u root –p. Enter your root password (mypass), press Enter and you are in the MySQL Monitor client.
3. There is an additional argument with which you can determine the host (IP or domain) MySQL that you want to enter. For example: mysql –u root –p –h 127.0.0.1 This allows you to log into remote MySQL servers, if you have been given permission to do so.
4. Select which database that you want to use. Type: USE test;
Note that every command-line directive that you type in the client ends with a semi-colon (;).
5. USE is a directive that tells MySQL which, of possibly many, database you want to work with. ‘test‘ is one of the default databases that comes with MySQL. If you know in advance what database you want to use, you can define this when entering MySQL: mysql –u root –p test
Try this. Type: Exit
You will exit the client.
Quit is an alternative to exit. Note that neither Exit or Quit require a semi-colon. These are the two exceptions to the rule.
6. Renter the client, defining the database upon login.
7. You can see the command line options in the client by typing: \h
8. You can use the up and down arrow keys to scroll through previous commands.
9. On Linux/UNIX Ctrl+A moves to the beginning of the line.
Ctrl+E moves to the end of the line (like in the EMACS text editor).
10. If you are typing a very long line, continue the line by typing \c and pressing Enter.
11. MySQL command line prompts are:
-> Continuing a command.
‘> Need to finish a single quote.
“>Need to finish a double quote.
12. Exit MySQL.