We first install Mysql-client as the client on the MySQL client:
$ sudo aptitude install mysql-client-5.6
Assuming all the preparations are in place, now you need a MySQL username and password. Below we log in to MySQL from the client's shell prompt, as follows:
Mysql-h Host-u User-p
If you are logged on locally to MySQL (that is, logging in from the server itself), or telnet to MySQL using the Secure Network connection tool (Ssh,secure Shell), you can omit the host parameter-H. Because the default host is localhost,localhost referencing your current system. In other environments, the command you enter must go through the network to reach the server, replacing the host parameter with a hostname that resolves to an IP address, or replaces host with the actual IP address of the MySQL server. In addition, the user parameter is replaced with the MySQL username. The-p option allows MySQL to prompt you for a password. You can also add a password directly after the-p option (for example, enter-prover,rover is the password); If you use this method, you should not leave a space between-p and the password name, however, it is not a safe way to enter a password on the command line, because the password is displayed on the screen, And the password is transmitted in clear text on the network, in addition, whenever another user gets a list of running processes on the server, the password can be seen.
After the MySQL server is used, enter quit or exit and click Enter to exit MySQL.
MySQL-based MySQL client