技术开发 频道

Mysql问题集锦

  成功安装了MySQL后用的语句

        net start mysql //启动服务器(在D:\MySQL\MySQL Server 5.0\bin 下)

  mysql -h localhost -u root -ppass;//连接数据库 root 是管理员 pass 是密码

  show databases ;//查看数据库名

  create database student;//建立数据库

  USE student;//应用这个数据库

  show tables;//查看表明

  CREATE TABLE Students(

  ID INT,

  name CHAR(20)); //建表

  INSERT INTO Students (ID,name)VALUES(1,"wang"); //插入纪录

  SELECT * FROM Students; //查看纪录

  mysql> show databases;

  +--------------------+

  | Database |

  +--------------------+

  | information_schema |

  | mysql |

  | student |

  | test |

  +--------------------+

  4 rows in set (0.13 sec)

  mysql> use student;

  Database changed

  mysql> show tables;

  +-------------------+

  | Tables_in_student |

  +-------------------+

  | students |

  +-------------------+

  1 row in set (0.11 sec)

  mysql> SELECT * FROM Students;

  +------+------+

  | ID | name |

  +------+------+

  | 1 | wang |

  +------+------+

  1 row in set (0.00 sec)

  mysql> exit //退出MySQL

  Bye

  D:\MySQL\MySQL Server 5.0\bin>

0
相关文章