- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
The MySQL Command-Line Client
The mysql is a simple SQL shell that has input line editing capabilities. It supports interactive and noninteractive usage. When it is used interactively, query results are presented in an ASCII-table format. When it is used noninteractively, like a filter, the result would be presented in tab-separated format.
The output format can be changed with the help of command options. If there are issues because of insufficient memory for large result sets, the --quick option can be used.
This forces the mysql to retrieve results from the server, a row at a time instead of retrieving the entire result set at once and buffering it in memory before it is being displayed. This is done by returning the result set with the help of the mysql_use_result() C API function which is present in the client/server library instead of mysql_store_result().
Using mysql is an easy task. It can be invoked from the prompt of the user’s command interpreter. It has been demonstrated below −
shell> mysql db_name
shell> mysql --user=user_name --password db_name
Enter password: your_password
Then an SQL statement can be typed, and can be ended with ;, \g, or \G.
Typing Control+C interrupts the current statement if there is such a statement, or cancels any partial input line if not.
SQL statements can be executed in a script file (or batch file). It has been shown below −
shell> mysql db_name < script.sql > output.tab
On Unix, the mysql client logs statements which are executed interactively to a history file.
- MySQL command line client for Windows?
- MySQL query to discover current default database collation (via command line client)?
- How to see spaces in data when selecting with MySQL command line client?
- Rainbow Stream – An Advanced Command-line Twitter Client for Linux
- Connecting to MySQL database from the command line?
- How to repair MySQL tables from the command line?
- Using Options on the Command Line for MySQL programs?
- Connect to MySQL database from command line
- Command Line Interpreters
- How to open MySQL command line on Windows10?
- How to upgrade MySQL server from command line?
- Java command line arguments
- What are the different MySQL prompts we have on the command line?
- How can we return to windows command shell from MySQL command line tool?
- How to adjust display settings of MySQL command line?