Below is a simple example which will print mysql version number.
D:\xampp\mysql\bin>mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.30-community MySQL Community Server (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> select version();
+------------------+
| version() |
+------------------+
| 5.1.30-community |
+------------------+
1 row in set (0.06 sec)
From the query and query about let's discuss about some default characters of issuing mysql commands and it's output.
1)MySQL commands end with semicolon. An exception is quit command.
2)After command is executed in server mysql shows mysql> prompt in order to indicate that it is suitable to take another input.
3)mysql displays query output in tabular form (rows and columns) by default.
4)After query is executed, it displays number of rows returned by the query as well as clock time needed for the query.
Let's now see another example.
mysql> select version()
-> ,
-> 'USER()
'> '
-> ,
-> "NOW()
"> "
-> ;
+------------------+---------+--------+
| version() | USER()
| NOW()
|
+------------------+---------+--------+
| 5.1.30-community | USER()
| NOW()
|
+------------------+---------+--------+
1 row in set (0.00 sec)
mysql>
It displays version number information and then displays two strings 'USER()' and "NOW()". But look at the mysql prompt. It changes from -> to '>, -> to "> , -> to mysql> etc. That prompt indicates that it is waiting for a letters(s) that mysql expects.
Following is the list of mysql prompts with their meaning.
1)mysql> : Mysql is ready to accept commands.
2)-> : Mysql waits for next line of multiple-line command.
3)'> : Waiting for next line plus waiting for completion of a string that began with a single quote (').
4)"> : Waiting for next line plus waiting for completion of a string that began with a double quote (").
5)`> : Waiting for next line plus waiting for completion of an identifier that began with a backtick (`).
6)/*> : Waiting for next line plus waiting for completion of a comment that began with /*.
Related Documents
http://arjudba.blogspot.com/2009/05/connecting-to-and-disconnecting-from.html
No comments:
Post a Comment