Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I am new to MySQL. I am trying to get table definitions from the database server (4.0.26).

I tried below steps to get information, running cmd as an administrator:

c:\> cd mysql\bin\
c:\mysql\bin>mysql -u username -p
password: password

mysql>show database

    -> (nothing comes up)

After closing and opening, same steps till password:

mysql>use database
Database changed

mysql>show tables

     -> (nothing comes up)

I need to check two table definitions. What am I missing?

share|improve this question

closed as off-topic by Jack Douglas Dec 31 '13 at 9:01

If this question can be reworded to fit the rules in the help center, please edit the question.

3  
This question appears to be off-topic because it is too basic for the site. –  Jack Douglas Dec 31 '13 at 9:01
1  
Something basic are helpful solve big issues –  sairam Dec 31 '13 at 13:29

2 Answers 2

you need to add semicolon at the end of your command.

     show databases;

     show tables;
share|improve this answer
    
Thanks Lyon.. it worked –  sairam Dec 31 '13 at 8:42
    
you are welcome. please accept it so that folks around would know there is a correct answer for your question. ;) –  Lyon Dec 31 '13 at 8:52

In Addition to @Lyon's Answer , I have explained with example

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| AbdulTest          |
| ClientDemo1        |
| mysql              |
| performance_schema |
| world              |
+--------------------+
14 rows in set (0.00 sec)


mysql> use world;
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;
+-----------------+
| Tables_in_world |
+-----------------+
| test            |
| test_reg        |
+-----------------+
2 rows in set (0.00 sec)

If you need to look table definition "CREATE STATEMENT" of table do like

mysql> SHOW CREATE TABLE test\G
*************************** 1. row ***************************
       Table: test
Create Table: CREATE TABLE `test` (
  `col1` varchar(20) DEFAULT NULL,
  `col2` varchar(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
1 row in set (0.00 sec)

For basic MySQL Syntax please have a look at Link .

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.