mysql is a simple SQL shell (with GNU readline capabilities). It supports interactive and non-interactive use. When used interactively, query results are presented in an ASCII-table format. When used non-interactively (for example, as a filter), the result is presented in tab-separated format. The output format can be changed using command options.
Using mysql is very easy. Lets See Below Code For Your Reference.
With Shell
mysql db_name
Or:
mysql --user=user_name --password=your_password db_name
Then type an SQL statement, end it with “;”, \g, or \G and press Enter.
Let we will see how we can connect mysql Database With Command Prompt
Before you can use MySQL, you need to create a database on your Control Panel. Once you have created a database, there are a few ways you can connect to it with the help of command line:
At a shell prompt you type all one 1 single line:
mysql -u DBUSERNAME -h DBSERVER -p DBNAME
DBUSERNAME: Database User Name
DBSERVER: Database Server Name(Most of the time Localhost)
DBNAME: Database Table Name
See Below Example For Further Help
Example:
mysql -u FutureS -h db.kb.com -p Client
DBUSERNAME: FutureS
DBSERVER: db.kb.com
DBNAME: Client
For Further Command Lines Syntax Visit Following Links:
http://dev.mysql.com/doc/refman/5.1/en/mysql-command-options.html
http://dev.mysql.com/doc/refman/5.1/en/mysql-commands.html