1. 查看版本 MariaDB [web1]> SELECT VERSION(); 2. 查看所有数据库 MariaDB [web1]> SHOW DATABASES; 3. 进入 web1 库 MariaDB [(none)]> USE web1; 4. 库中查看表 MariaDB [web1]> SHOW TABLES; 5. 查看其他库中表 MariaDB [web1]> SHOW TABLES FROM web2; 6. 查看创建表语句 MariaDB [web1]> SHOW CREATE TABLE score; 7. 查看表结构 MariaDB [web1]> DESC score; 8. 查看当前所在库 MariaDB [web1]> SELECT DATABASE(); 9. 查看数据库支持的存储引擎 MariaDB [web1]> SHOW ENGINES; +--------------------+---------+----------------------------------------------------------------------------------+--------------+------+------------+ | Engine | Support | Comment | Transactions | XA | Savepoints | +--------------------+---------+----------------------------------------------------------------------------------+--------------+------+------------+ | MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO | | MRG_MyISAM | YES | Collection of identical MyISAM tables | NO | NO | NO | | CSV | YES | Stores tables as CSV files | NO | NO | NO | | BLACKHOLE | YES | /dev/null storage engine (anything you write to it disappears) | NO | NO | NO | | MyISAM | YES | Non-transactional engine with good performance and small data footprint | NO | NO | NO | | ARCHIVE | YES | gzip-compresses tables for a low storage footprint | NO | NO | NO | | FEDERATED | YES | Allows to access tables on other MariaDB servers, supports transactions and more | YES | NO | YES | | PERFORMANCE_SCHEMA | YES | Performance Schema | NO | NO | NO | | SEQUENCE | YES | Generated tables filled with sequential values | YES | NO | YES | | InnoDB | DEFAULT | Supports transactions, row-level locking, foreign keys and encryption for tables | YES | YES | YES | | Aria | YES | Crash-safe tables with MyISAM heritage | NO | NO | NO | +--------------------+---------+----------------------------------------------------------------------------------+--------------+------+------------+ 10. 查看系统变量及其值 MariaDB [web1]> SHOW VARIABLES; 11. 查看某个系统变量 MariaDB [web1]> SHOW VARIABLES LIKE '%wait_timeout%'; +--------------------------+-------+ | Variable_name | Value | +--------------------------+-------+ | innodb_lock_wait_timeout | 50 | | lock_wait_timeout | 86400 | | wait_timeout | 28800 | +--------------------------+-------+
12. 语言分类
DQL (Data Query Language) 数据查询语言 select等
DML (Data Manipulate Language) 数据操作语言 insert、update、delete等
DDL (Data Define Language) 数据定义语言 create、drop、alter语句
TCL (Transaction Control Language) 事务控制语言 commit,rollback等