MySQL 5.5 Command Line Client SQL common statements
A. create databases and data tables
Root Login MySQL
Create a database named demo
Create schema demo;
USE the USE command to specify the demo Database
USE demo;
Create a t_message table with fields such as id, name, email, and msg.
Create table t_message (
Id int not null AUTO_INCREMENT primary key,
Name CHAR (20) not null,
Email CHAR (40 ),
Msg TEXT NOT NULL
);
Set the id to AUTO_INCREMENT, indicating that MySQL manages the value of a field. If no id value is specified, it will automatically increase according to the id value of the previous data; specify the primary key. You can specify fields to set the primary key. You can also set the primary key as follows:
Create table t_message (
Id int not null AUTO_INCREMENT,
Name CHAR (20) not null,
Email CHAR (40 ),
Msg text not null,
Primary key (id)
);
Delete A data table
Drop table t_message;
Delete the entire database
Drop schema demo;
For more details, please continue to read the highlights on the next page:
Recommended reading:
MySQL 5.5 Command Line Client cannot be opened (disappears in a flash) Solution
Load Nginx in Ubuntu for high-performance WEB Server 5 --- MySQL master/Master Synchronization
Production Environment MySQL master/Master synchronization primary key conflict handling
MySQL Master/Slave failure error Got fatal error 1236
MySQL master-slave replication, implemented on a single server
Compile and install MySQL dual-instance in Ubuntu and configure master-slave Replication