MySQL generally does not enable the table key command completion by default. To enable the command completion feature, you can modify the/ETC/MY.CNF or/etc/mysql/my.cnf file.
1. View the database
Mysql> show databases; +--------------------+| Database |+--------------------+| information_schema | | mysql | | performance_schema |+--------------------+ 3 in Set (0.01 sec)
2.
The commands commonly used in the MySQL database process are listed below:
- use database name : Select the MySQL database you want to manipulate, and all MySQL commands are only for that database after using this command.
- SHOW DATABASES: lists a list of databases for the MySQL database management system.
- Show TABLES: Displays all tables for the specified database and uses the use command to select the database to manipulate before using the command.
- show COLUMNS from data table : Displays data table properties, property types, primary key information, whether null, default value, and other information.
- Show index from data table : displays detailed index information for the data table, including primary key (primary key).
- SHOW table STATUS like datasheet \g: This command will output the performance and statistics of the MySQL database management system.
3. Create a new database
CREATE DATABASE [new database];
4. Delete Database
drop database [existed database];
Drop database if exists [database not sure if exist];
5. Use the database
Use [one database];
6. Create a new table
CREATE TABLE student (no char, name varchar, primary key (NO));
7. Delete Table
drop table [a table];
8. Table renaming
Rename table [old name] to [new name]
9. Table Insert Data
INSERT into student (No,name) VALUES (' 2012001 ', ' Jodan ');
MySQL Basic operation