34,333
edits
Changes
→The mysql Command-line Utility
The ''mysql'' tool is probably the most useful utility and is the tool that you will likely use the most as you learn and continue to use MySQL. ''mysql'' is a command-line client tool that is installed as standard with the MySQL package. From the ''mysql'' command-prompt it is possible to issue a wide range of commands to the database server such as creating and deleting databases and tables, searching for data, adding new rows and much more. Throughout this book the capabilities of the ''mysql'' tool will be covered in great detail.
Assuming MySQL has been installed (see [[Installing MySQL on Linux]] or [[Installing MySQL on Windows]] for installation details) the ''mysql'' tool may be loaded at the operating system command-prompt as follows:
<pre>
</pre>
If you see an error message, it may be that your database system is configured to require login credentials, or that the server is running on a different system. For example, if your database server requires a username and password to gain access the -u and -p command-line options may be used respectively:
<pre>
A list of command-line options can be obtained running ''mysql --help'' at the command-prompt (listed below).
Once ''mysql'' is running , commands are entered at the ''mysql>'' prompt. Typing ''help'' at this prompt will display a list of the commands supported by the tool (listed below).
Commands are terminated by a semi-colon (;). If a command is not terminated by a semi-colon, pressing enter simply continues the current command on the following line.