你登录后,是不是出现一个下面命令提示符呀?
Enter password: ********
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 23 to server version: 4.1.12-nt-logType 'help;' or '\h' for help. Type '\c' to clear the buffer.mysql>
你就直接在下边写SQL语句,然后以分号结束,按Enter.
mysql> use mysql;
Database changed
mysql> show tables;
+---------------------------+
| Tables_in_mysql           |
+---------------------------+
| columns_priv              |
| db                        |
| func                      |
| help_category             |
| help_keyword              |
| help_relation             |
| help_topic                |
| host                      |
| tables_priv               |
| time_zone                 |
| time_zone_leap_second     |
| time_zone_name            |
| time_zone_transition      |
| time_zone_transition_type |
| user                      |
| user_info                 |
+---------------------------+
16 rows in set (0.01 sec)还有就是:select,update,alter命令,你自己去找一下啦.

解决方案 »

  1.   

    多看看使用手册D:\mysql50\bin>mysql -uroot 
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 9 to server version: 5.0.13-rc-ntType 'help;' or '\h' for help. Type '\c' to clear the buffer.mysql>
    mysql> show tables from test;
    +----------------+
    | Tables_in_test |
    +----------------+
    | t              |
    | tmp1           |
    +----------------+
    2 rows in set (2.51 sec)mysql> desc test.t;
    +-------+---------+------+-----+---------+-------+
    | Field | Type    | Null | Key | Default | Extra |
    +-------+---------+------+-----+---------+-------+
    | s1    | int(11) | NO   | PRI | 0       |       |
    +-------+---------+------+-----+---------+-------+
    1 row in set (2.72 sec)mysql> select @@version;
    +--------------+
    | @@version    |
    +--------------+
    | 5.0.13-rc-nt |
    +--------------+
    1 row in set (0.23 sec)
      

  2.   

    1、mysql4.1及以上版本用group_concat函数实现,sql server一般用一个自定义函数实现mysql> use test;
    Database changed
    mysql> show tables;
    +----------------+
    | Tables_in_test |
    +----------------+
    | t              |
    | tmp1           |
    +----------------+
    2 rows in set (0.31 sec)mysql> create table t1(no int not null,name varchar(10));
    Query OK, 0 rows affected (0.51 sec)mysql> insert into t1 values
        -> (1,'a'),(1,'b'),(1,'c'),(1,'d'),(2,'a'),(2,'b'),(2,'c'),(3,'d');
    Query OK, 8 rows affected (0.13 sec)
    Records: 8  Duplicates: 0  Warnings: 0mysql> select * from t1;
    +----+------+
    | no | name |
    +----+------+
    |  1 | a    |
    |  1 | b    |
    |  1 | c    |
    |  1 | d    |
    |  2 | a    |
    |  2 | b    |
    |  2 | c    |
    |  3 | d    |
    +----+------+
    8 rows in set (0.16 sec)mysql> select no,group_concat(name separator ' ') from t1 group by no;
    +----+----------------------------------+
    | no | group_concat(name separator ' ') |
    +----+----------------------------------+
    |  1 | a b c d                          |
    |  2 | a b c                            |
    |  3 | d                                |
    +----+----------------------------------+
    3 rows in set (1.36 sec)
      

  3.   

    如何查看mysql里都有哪些数据库,如何看数据库名称?