Enter your password when prompted. You can then try the following command, which should result in something like the screen grab.
SHOW databases;
There may be other databases already created, and the test database may not be there. Bear in mind also that system administrators have ultimate control over everything and that you can encounter some unexpected setups. For example, you may find that you are required to preface all database names that you create with a unique identifying string to ensure that you do not conflict with databases created by other users.
If you have any problems, have a word with your system administrator, who should be able to sort them out. Let the sysadmin know that you need a username and password, and request the ability to create new databases or, at a minimum, to have at least one database created for you ready to use. You can then create all the tables you require within that database.
Using the Command-Line Interface
From here on out, it makes no difference whether you are using Windows, OS X, or Linux to access MySQL directly, as all the commands used (and errors you may receive) are identical.
The semicolon
Let’s start with the basics. Did you notice the semicolon (;) at the end of the SHOW databases; command that you typed? The semicolon is used by MySQL to separate or end commands. If you forget to enter it, MySQL will issue a prompt and wait for you to do so. The required semicolon was made part of the syntax to let you enter multiple line commands, which can be convenient, because some commands get quite long. It also allows you to issue more than one command at a time by placing a semicolon after each one. The interpreter gets them all in a batch when you press the Return key and executes them in order.
It’s very common to receive a MySQL prompt instead of the results of your command; it means that you forgot the final semicolon. Just enter the semicolon, press the Return key, and you’ll get what you want.
Canceling a command
If you are partway through entering a command and decide you don’t wish to execute it after all, whatever you do, don’t press Ctrl-C! That will close the program. Instead, you can enter \c and press Return.
When you type in that line, MySQL will ignore everything you typed and issue a new prompt. Without the \c, it would have displayed an error message. Be careful, though:
if you have opened a string or comment, you’ll need to close it before using the \c or MySQL will think the \c is just part of the string. Also note that using \c after a semicolon will not work, as it is then a new statement.
MySQL prompt Meaning
mysql> MySQL is ready and waiting for a command
-> Waiting for the next line of a command
‘> Waiting for the next line of a string started with a single quote
“> Waiting for the next line of a string started with a double quote
`> Waiting for the next line of a string started with a backtick
/*> Waiting for the next line of a comment started with /*
Sources for further reading
No comments yet (leave a comment)