Article directory
Common commands of mysql
- View all current databases
show databases;- Open the specified library
use library name- View all tables in the current library
show tables;- View all tables of other libraries
show tables from library name;- Create table
create table table name (
column name column type,
column name list type,
...
)- View the table structure
desc table name;- View the definition information of the (library name) database created earlier
show create database database name- Delete the created (library name) database
drop database library name- Backup database table
mysqldump -u root (user name) -p password -B (database) hsp_db01 hsp_db02 > d:\\bak.sql file name- Check the version of the server
Method 1: Log in to the mysql server
select version();
Method 2: Not logged in to the mysql server
mysql --version
or mysql --v
Mysql syntax specification
1. Case-sensitive, capitalized keywords, table name , column name
lowercase text – comment text multiline comment: /* comment text */