MySQL commonly used commands (database creation, use, deletion)
1. Check the MySQL version
select version();
2. Create a database
Syntax format:
CREATE DATABASE 数据库名称;
Example: create a teststudent database
create database teststudent;
3. Choose and use the database
Syntax format:
use 数据库名称;
Example: select and use the newly created teststudent database
4. Delete the database
Syntax format:
drop database 数据库名;
Example: Delete the teststudent database that was just created:
drop database teststudent;
5. Terminate a statement
If you want to terminate a statement you are writing, you can type \c
6. Exit MySQL
You can use \q or quit or exit to exit MySQL