Saturday, February 3, 2007

MySQL client startup options

MySQL client comes with an large number of startup options, some of which are extremely useful in daily MySQL interaction.

This option compresses the upstream and downstream data packets transferred between the client and server, assuming both ends of the connection support such compression. Use this option to improve performance when communication bandwidth is limited -- for example, over a slow network link.

This option forces MySQL to write debugging data to a special log file, both at startup and shutdown and when processing transactions. It can be usefully combined with the --debug-info option for additional debugging information. Use this option to obtain detailed diagnostic information on MySQL, particularly when working with an experimental server or client.

This option forces MySQL to continue processing a block of SQL commands even if an error occurred. Use this option during an automated installation/de-installation routine -- for example, when you're attempting to bulk-inject records into a database as part of application initialization and don't want duplicate entries to disrupt the process.

This option pipes the output of MySQL queries to an external "pager" program such as cat, less or more. Use this option when your query returns a large result set and you wish to interactively page through it screen by screen.

This option formats the result of your MySQL queries as well-formed XML. Use this option when you wish to package the output of your queries in a standard format, usually as a prelude to integrating it with a third-party application.

This option tells the MySQL client to ignore all commands except those related to the database named in the option. Use this option to filter out actions pertaining to a single database from an SQL injection file, or to skip certain database updates.

This option lets you log all query output to an external file. Use this option when you need a record of your transactions, either for later reference or to maintain an audit trail.

Normally, the MySQL client will automatically abort if unable to connect to the server. This option forces it to wait for a defined interval and then try again. Use this option to cut down on keystrokes when attempting to contact a remote or non-responsive MySQL server.

This option tells MySQL to ignore all unqualified DML commands -- that is, commands that do not contain filter criteria such as WHERE, LIMIT or HAVING clauses. This provides a safety net against accidental modification or deletion of complete tables or databases. Use this option when you want to automatically protect yourself from dangerous queries that could cause widespread data corruption or loss.

This option allows you to alter the standard mysql> command prompt using various pre-defined format specifiers. Use this option to make your MySQL client print useful navigation or temporal information during your MySQL session -- for example, the current date or time, server statistics or your location in the database/table hierarchy.

No comments: