Basic database statement (1)

1. R (query)
query all database names (show databases;) *********
view the creation statement of one of the "mysql" databases (show create database mysql;)
2. C (Create)
create a database sl (create database sl;) **********
create datebase if not exisit sl; (if sl does not exist, it will create the sl database, otherwise it will not be created)*** **********
If you want to change the default utf8 (utf8 is the character set) of the created database sl, then create it (create database sl character set gbk;) ********** *
Create a database db3, determine whether there is a database with the same name, and change the path (create database if not exists db3 character set gbk;)
3. Modify (U)
modify the database character set (alter database database name character set character set name;)************
Delete database (drop database database name;)*********
Determine whether the database exists, and then delete it (drop database if exisits database name)********
4. Use database
Query the database name currently being used (select database();)*********
Use database (use database name)********

Guess you like

Origin blog.csdn.net/m0_46217913/article/details/104063495