amp1:~ # mysql -uroot -pmysql.rzrk
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2132
Server version: 5.0.95-log SUSE MySQL RPM
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
2 使用xiaobing库
1
2
mysql> use xiaobing;
Database changed
3 查xiaobing库中的表
1
2
3
4
5
6
7
8
mysql> show tables;
+--------------------+
| Tables_in_xiaobing |
+--------------------+
| luzhi |
| t1 |
+--------------------+
2 rows in set (0.00 sec)
4 查表luzhi的表结构
1
2
3
4
5
6
7
8
mysql> desc luzhi;
+-------+----------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+----------+------+-----+---------+-------+
| id | int(10) | YES | | NULL | |
| name | char(30) | YES | | NULL | |
+-------+----------+------+-----+---------+-------+
2 rows in set (0.00 sec)
5 查看表luzhi的数据
1
2
3
4
5
6
7
8
9
10
mysql> seclect * from luzhi;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'seclect * from luzhi' at line 1
mysql> select * from luzhi;
+------+-------+
| id | name |
+------+-------+
| 2 | o` |
| 4 | f |
+------+-------+
4 rows in set (0.00 sec) ##发现输出为乱码