MySQL数据库安装与配置详解
MySQL的安装请参考下面这篇博客,讲述的非常详细,各种截图也很清晰。
http://www.cnblogs.com/sshoub/p/4321640.html
MySQL简单操作
大家可以安装下面的这个博客来进行一些简单的MySQL的操作,讲得非常详细,有语法和具体实例。
http://www.runoob.com/mysql/mysql-tutorial.html
- 创建一个表
书名 出版社
runoob_id INT NOT NULL AUTO_INCREMENT,
runoob_title VARCHAR(100) NOT NULL,
runoob_author VARCHAR(40) NOT NULL,
submission_date DATE,
PRIMARY KEY ( runoob_id )
);```
2. 在表里插入数据
```INSERT INTO runoob_tbl
(runoob_title, runoob_author, submission_date)
VALUES
("学习 PHP", "菜鸟教程", NOW());```
```INSERT INTO runoob_tbl
(runoob_title, runoob_author, submission_date)
VALUES
("学习 Python", "菜鸟教程", NOW());```
```INSERT INTO runoob_tbl
(runoob_title, runoob_author, submission_date)
VALUES
("学习 MySQL", "菜鸟教程", NOW());```
3. 查询表里的数据
```select * from runoob_tbl;```
1. show databases;
2. create database example;
3. use example;
1. show databases;
2. create database example;
3. use example;
4. drop database example;
5. create database example;
6. use example;
创建一个表,有以下属性
id name author publish_date
7.
CREATE TABLE book(
id INT NOT NULL AUTO_INCREMENT,
name VARCHAR(100) NOT NULL,
author VARCHAR(40) NOT NULL,
publish_date DATE,
PRIMARY KEY ( id )
);
insert into book (name, author, publish_date) values ("learn django", "yating","2016-09-01");
select * from book where name="learn mysql" and id=1;
select name, author from book;