MySQL ToolsAs just explained, MySQL is a client-server DBMS, and so to use MySQL you'll need a client, an application that you'd use to interact with MySQL (giving it commands to be executed).
There are lots of client application options, but when learning MySQL (and indeed, when writing and testing MySQL scripts) you are best off using a utility designed for just that purpose. And there are three tools in particular that
mysql Command-Line Utility
Every MySQL installation comes with a simple command-line utility called
mysql
. This utility does not have any drop-down
Typing
mysql
at your operating system command prompt
Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 14 to server version: 5.0.4-nt Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql>
Note
MySQL Options and Parameters
If you just type
mysql
by itself, you might receive an error message. This will likely be because security credentials are needed or because MySQL is not running locally or on the default port.
mysql
accepts an array of command-line parameters you can (and might need to) use. For example, to specify a user login
A complete list of command-line options and parameters can be obtained using mysql help .
Of course, your version and connection information might
The mysql command-line utility is one of the most used and is invaluable for quick testing and executing scripts (such as the sample table creation and population scripts mentioned in the previous chapter and in Appendix B, "The Example Tables"). In fact, all of the output examples used in this book are grabs from the mysql command-line output.
Tip
Familiarize Yourself with the
mysql
Command-Line Utility
Even if you opt to use one of the graphical tools described
MySQL AdministratorMySQL Administrator is a graphical interactive client designed to simplify the administration of MySQL servers.
Note Obtaining MySQL Administrator MySQL Administrator is not installed as part of the core MySQL installation. Instead, it must be downloaded from http://dev.mysql.com/downloads/ (versions are available for Linux, Mac OS X, and Windows, and source code is downloadable, too). MySQL Administrator prompts for server and login information (and allows you to save server definitions for future selection), and then displays icons that allow for the selection of different views. Amongst these are
Note Create a Datasource for This Book You might want to use the Create New Schema option to create a datasource for the tables and chapters in this book. The examples use a datasource named crashcourse ; feel free to use the same name or one of your choice.
Tip Quick Access to Other Tools The MySQL Administrator Tools menu contains options to launch the mysql command-line utility (described previously) and the MySQL Query Browser (described next). In fact, the MySQL Query Browser also contains menu options to launch the mysql command-line utility and the MySQL Administrator. MySQL Query BrowserMySQL Query Browser is a graphical interactive client used to write and execute MySQL commands.
Note Obtaining MySQL Query Browser Like MySQL Administrator, MySQL Query Browser is not installed as part of the core MySQL installation. Instead, it too must be downloaded from http://dev.mysql.com/downloads/ (versions are available for Linux, Mac OS X, and Windows, and source code is downloadable, too). MySQL Query Browser prompts for server and login information (saved definitions are shared between MySQL Query Browser and MySQL Administrator) and then displays the application interface. Note the following:
Tip Execute Saved Scripts You can use MySQL Query Browser to execute saved scriptsthe scripts used to create and populate the tables used in throughout this book, for example. To do this, select File, Open Script, select the script (which will be displayed in a new tab), and click the Execute button. |