Showing posts with label mysql -u root -p -v. Show all posts
Showing posts with label mysql -u root -p -v. Show all posts

Friday, 13 January 2012

MySQL verbose Option

The verbose option tells MySQL to display SQL before running it. This is useful when using the source command to run SQL from a file. You can see what I mean in the example which follows. Here is a file containing a single SQL statement:
 
UNIX > cat count_star.sql
select count(*) from mysql.user;
UNIX >
 
When you run it from MySQL with the verbose (-v) option, the SQL appears before the output it produces:
 
UNIX > mysql -u root -p -v
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 53444
Server version: 5.0.67 Source distribution
 
Reading history-file /usr/local/mysql/.mysql_history
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
 
mysql> source count_star.sql
--------------
select count(*) from mysql.user
--------------
 
+----------+
| count(*) |
+----------+
|       18 |
+----------+
1 row in set (0.00 sec)
 
mysql> exit
Writing history-file /usr/local/mysql/.mysql_history
Bye
UNIX >