数据库简单操作

来源:互联网 发布:淘宝千万不能搜索的 编辑:程序博客网 时间:2024/06/05 19:32

mysql数据库简单操作

查看当前所有数据库

mysql> show databases;+--------------------+| Database           |+--------------------+| information_schema || jdbc               || mysql              || performance_schema || test               |+--------------------+5 rows in set (0.00 sec)

创建数据库test_db

mysql> create database test_db;Query OK, 1 row affected (0.01 sec)mysql> show databases;+--------------------+| Database           |+--------------------+| information_schema || jdbc               || mysql              || performance_schema || test               || test_db            |+--------------------+6 rows in set (0.00 sec)

查看已创建数据库test_db的定义

mysql> show create database test_db\G;*************************** 1. row ***************************   Database: test_dbCreate Database: CREATE DATABASE `test_db` /*!40100 DEFAULT CHARACTER SET latin1 */1 row in set (0.00 sec)ERROR:No query specified

删除数据库test_db

mysql> drop database test_db;Query OK, 0 rows affected (0.00 sec)mysql> show databases;+--------------------+| Database           |+--------------------+| information_schema || jdbc               || mysql              || performance_schema || test               |+--------------------+5 rows in set (0.00 sec)

存储引擎

mysql> show engines \G;*************************** 1. row ***************************  Engine: FEDERATED Support: NO Comment: Federated MySQL storage engineTransactions: NULL          XA: NULL  Savepoints: NULL*************************** 2. row  ***************************      Engine: MRG_MYISAM     Support: YES     Comment: Collection of identical MyISAM tablesTransactions: NO          XA: NO  Savepoints: NO*************************** 3. row ***************************      Engine: MyISAM     Support: YES     Comment: MyISAM storage engineTransactions: NO          XA: NO    Savepoints: NO*************************** 4. row ***************************      Engine: BLACKHOLE     Support: YES     Comment: /dev/null storage engine (anything you write to it disappears)Transactions: NO          XA: NOSavepoints: NO*************************** 5. row ***************************      Engine: CSV     Support: YES     Comment: CSV storage engineTransactions: NO          XA: NO  Savepoints: NO*************************** 6. row ***************************      Engine: MEMORY     Support: YES     Comment: Hash based, stored in memory, useful for temporary tablesTransactions: NO      XA: NOSavepoints: NO*************************** 7. row ***************************      Engine: ARCHIVE     Support: YES     Comment: Archive storage engineTransactions: NO          XA: NOSavepoints: NO*************************** 8. row ***************************      Engine: InnoDB     Support: DEFAULT     Comment: Supports transactions, row-level locking, and foreign keysTransactions: YES          XA: YES    Savepoints: YES*************************** 9. row ***************************      Engine: PERFORMANCE_SCHEMA     Support: YES     Comment: Performance SchemaTransactions: NO          XA: NOSavepoints: NO9 rows in set (0.03 sec)ERROR:No query specified

Support列的值表示某种引擎是否能使用:YES表示可以使用,NO表示不能使用,DEFAULT表示该引擎为当前默认引擎。

原创粉丝点击