一、(dos下)数据库的创建、删除、查看和使用

2、数据库和数据库表操作

1.1 普通方式登录后再使用数据库

 1 Microsoft Windows [版本 6.1.7601]
 2 版权所有 (c) 2009 Microsoft Corporation。保留所有权利。
 3 
 4 C:\Users\Dell>cd c:\
 5 
 6 c:\>d:
 7 
 8 D:\>cd D:\Program Files\MySQL\MySQL Server 5.0\bin
 9 
10 D:\Program Files\MySQL\MySQL Server 5.0\bin>mysql -uroot -p
11 Enter password: ****
12 Welcome to the MySQL monitor. Commands end with ; or \g.
13 Your MySQL connection id is 3
14 Server version: 5.0.45-community-nt MySQL Community Edition (GPL)
15 
16 Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
17 
18 mysql> --1.创建数据库
19 mysql> create database if not exists hollydata;
20 Query OK, 1 row affected (0.05 sec)
21 
22 mysql> --2.查看数据库
23 mysql> show databases;
24 +--------------------+
25 | Database |
26 +--------------------+
27 | information_schema |
28 | hollydata |
29 | mysql |
30 | test |
31 +--------------------+
32 4 rows in set (0.00 sec)
33 
34 mysql> --3.删除数据库
35 mysql> drop database if exists hollydata;
36 Query OK, 0 rows affected (0.31 sec)
37 
38 mysql> --4.查看数据库
39 mysql> show databases;
40 +--------------------+
41 | Database |
42 +--------------------+
43 | information_schema |
44 | mysql |
45 | test |
46 +--------------------+
47 3 rows in set (0.00 sec)
48 
49 mysql> --5.使用数据库(也就是数据的切换)
50 mysql> use test
51 Database changed
52 mysql>
数据库的创建、删除、查看、使用

相关文章: