Sunday 18 December 2011

MySQL show tables from command

If you are using one database, you can see the tables in a different one with the show tables from command:
 
mysql> use test;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
 
Database changed
mysql> show tables from andrew;
+------------------+
| Tables_in_andrew |
+------------------+
| andrews_table    |
+------------------+
1 row in set (0.00 sec)
 
mysql>

And you can look at the contents of a table from another database by concatenating the database name, a dot and the table name:

mysql> select * from andrew.andrews_table;
Empty set (0.01 sec)
 
mysql>

No comments: