1. Database ("Pikachu" Here is the database name)
SHOW DATABASES; # #查看数据库
Use Pikachu; # #切换到数据库
CREATE DATABASE Pikachu; #创建数据库
DROP DATABASE Pikachu; #删除数据库
2. table ("Student" here is the table name)
SHOW TABLES; #查看表
CREATE TABLE Student (name VARCHAR), sex CHAR (1)); # #创建表
DROP TABLE student; # #从数据库中删除表
describe student; # #查看表结构
INSERT into student VALUES (' Lmy ', ' F '); # # Add information to the table
DELETE from student WHERE attribute = value; # #从表中删除信息
SELECT * from student; # #查看表中所有信息
UPDATE student SET attribute=value2 WHERE attribute > =value1; # #修改表中信息, change the value1 in the table to value2
ALTER TABLE Student Add age varchar (4); # #向表中添加 "Age" field
ALTER TABLE student DROP age; # #从表中删除字段
3. Enquiry
SELECT * from Pikachu.student; # #查询pikachu数据库下的student表
SELECT name from student WHERE age= ' and sex= ' M '; # #查询student表中年龄为20, sex man's name
4. Refreshing the database Information
FLUSH privileges;
5.mysql root user password forgot solution
This article from "11849650" blog, declined reprint!
Review the--mysql base statement