From Li Xinghua video.
1. Start the command line mode
2. Connect to the MySQL database, where "-u" is marked with the input user name, "-P" is marked with the input password.
3. Create a new database--MLDN, using UTF-8 encoding:
Create database mldn character set UTF8;
4. View all databases:
show databases;
5. Use the MLDN database:
Use MLDN;
6. Create a data sheet:
CREATE TABLE News (
Nid int Auto_increment,
Title varchar (+) is not NULL,
Content text,
Constraint Pk_nid primary KEY (NID)
)engine = InnoDB;
In MySQL can no longer use number, VARCHAR2, can only be used int, double, text, varchar type, where auto_increment indicates that the NID column will be in the way of automatic growth, and finally added "engine =innodb ", which indicates that this table supports the thing handling feature.
Example: adding data
INSERT into News (title, content) VALUES ("Wangke", "Wangyan.");
7. If the growing primary key is taken in MySQL, use the following syntax:
MySQL Basic use