The mysql client is an interactive program that allows you to connect to the server, issue queries, and view the results. mysql may also be used in batch mode to execute queries that are stored in a file if you redirect the input of the command to read from that file. For example:

% mysql -u paul -p -h samp_db < my_query_file

In interactive mode, when mysql starts up, it displays a prompt 'mysql>' to indicate that it's waiting for input. To issue a query, type it in (using multiple lines if necessary) and then indicate the end of the query by typing ';' (semicolon) or '\g'. mysql sends the query to the server, displays the results, and then prints another prompt to indicate that it's ready for another query.

mysql ...

Get MySQL now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.