More MySQL tips. Listing databases and viewing the MySQL version.

Posted: August 30, 2012. At: 9:30 PM. This was 5 years ago. Post ID: 4513
Page permalink.
WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters. These cookies expire two weeks after they are set.

How to list tables in a MySQL database.

mysql> show tables in acme;
+----------------+
| Tables_in_acme |
+----------------+
| address        |
| customer       |
| discount       |
| order_header   |
| order_line     |
| order_shipment |
| payment_terms  |
| phone          |
| product        |
| reseller       |
| salesman       |
| shipment       |
| status         |
+----------------+
13 rows in set (0.00 sec)

Listing the databases in your MySQL installation.

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| acme               |
| fun                |
| mysql              |
| performance_schema |
| test               |
+--------------------+
6 rows in set (0.00 sec)
 
mysql>
</pre lang="bash">
 
How to get the MySQL version with SQL.
 
<pre lang="bash">
mysql> select @@version;
+-------------------------+
| @@version               |
+-------------------------+
| 5.5.24-0ubuntu0.12.04.1 |
+-------------------------+
1 row in set (0.00 sec)

No comments have been made. Use this form to start the conversation :)

Leave a Reply