.comment-link {margin-left:.6em;}

IntTech

Monday, September 14, 2009

Browsing MySQL from Command Line

To view a MySQL schema from the command line, use the commands show databases;, show tables; , and describe . See the following example:

mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| email |
| elggDB |
| wikiDB |
+--------------------+
4 rows in set (0.00 sec)


mysql> show tables
-> ;
+------------------+
| Tables_in_email |
+------------------+
| access_sender |
| alias |
| transport |
| user2domains |
+------------------+
4 rows in set (0.00 sec)

mysql> describe alias
-> ;
+----------+------------------+------+-----+
| Field | Type | Null | Key |
+----------+------------------+------+-----+
| id | int(11) unsigned | NO | PRI |
| username | varchar(128) | NO | |
| domain | varchar(128) | YES | |
| enabled | enum('Y','N') | NO | |
| goto | varchar(128) | NO | |
| notes | varchar(255) | YES | |
| updated | timestamp | NO | |
+----------+------------------+------+-----+
7 rows in set (0.00 sec)

Bookmark and Share

0 Comments:

Post a Comment

<< Home


Google