10 secret MySQL client startup options you should know
Takeaway: The standard MySQL client comes with a large number of startup options, some of which are extremely useful in daily MySQL interaction. Several of the less well-known startup options available for the MySQL client program are explored and explained.
Most server administrators know that the MySQL relational data base management system (RDBMS) is a highly flexible piece of software and comes with a wide range of startup options that can be used to modify its behavior. What most don't know, however, is that the standard MySQL client comes with an equally large number of startup options, some of which are extremely useful in daily MySQL interaction. While these options are not "secret" per se, they remain largely unused, even though they can significantly ease the process of server interaction.
Listed in Table A are some of the less well-known startup options for the MySQL client program. Each entry in the table explains what each option does and how it can be used. This will give you some idea of the scope and scale of the MySQL client and help you in your daily application development.
Table A
|
Option |
What Does It Do? |
When Should You Use It? |
| --compress |
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. |
| --debug |
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. |
| --force |
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. |
| --pager |
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. |
| --xml |
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. |
| --one-database |
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. |
| --tee |
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. |
| --wait |
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. |
| --safe-updates |
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. |
| --prompt |
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. |
You can read more about these (and other options) in the MySQL manual.
White Papers, Webcasts, and Downloads
- Five Steps to Determine When to Virtualize YourServers VMware Thinking of virtualizing the servers at your company? Use this step-by-step guide to determine when's the best time to make your big move. Download Now
- The True Costs of Virtual Server Solutions VMware Discover ways to streamline and simplify your assessment of the total acquisition costs of a server virtualization environment. Download Now
- VMware Infrastructure: A Guide to Bottom-Line Benefits VMware Frustrated by the high cost of maintaining or building ever-larger data centers? Get the facts you need to formulate your Virtualization Action Plan. Download Now
- Building the Virtualized Enterprise with VMware Iinfrastructure VMware VMware virtualization software has been adopted by over 120,000 enterprise ... Download Now
- Why Isn't Server Virtualization Saving Us More? A Few Small Changes May Dramatically Increase Your Efficiency VMware Ever wonder why your company isn't saving more from its server virtualization? Making a few small changes could dramatically increase your efficiency. Download Now
Article Categories
- Security
- Security Solutions, IT Locksmith
- Networking and Communications
- E-mail Administration NetNote, Cisco Routers and Switches
- CIO and IT Management
- Project Management, CIO Issues, Strategies that Scale
- Desktops, Laptops & OS
- Windows 2000 Professional, Microsoft Word, Microsoft Excel, Microsoft Access, Windows XP,
- Data Management
- Oracle, SQL Server
- Servers
- Windows NT, Linux NetNote, Windows Server 2003
- Career Development
- Geek Trivia
- Software/Web Development
- Web Development Zone, Visual Basic, .NET

