数据库Mysql 引擎的基本操作

                                            数据库操作

1.  显示mysql 支持的数据引擎 

show engines

2. 设置Innodb为默认引擎

永久化使用需要修改mysql的配置文件的my.cnf 中的[mysqld]下面的

default-storge-engine =INNODB

3. 显示数据库的表状态
            显示数据库所有表状态  
SHOW TABLE STATUS 
        后面可加where 条件 对应Name 值为 表名
show table status where Name = "表名"

                                               数据库表操作

1.  显示 数据库表的create table 内容

show Create table  "表名"
use blog;
show CREATE TABLE art

显示的结果:

CREATE TABLE `art` (

  `art_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `cat_id` smallint(5) unsigned DEFAULT '0',
  `user_id` int(10) unsigned DEFAULT '0',
  `nick` varchar(45) DEFAULT '',
  `title` varchar(45) DEFAULT '',
  `content` text,
  `pic` varchar(50) NOT NULL DEFAULT '',
  `pubtime` int(10) unsigned NOT NULL DEFAULT '0',
  `lastup` int(10) unsigned DEFAULT '0',
  `comm` smallint(5) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`art_id`)

) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COMMENT='文章表'

2.  修改表引擎 

ALTER TABLE art ENGINE = MyISAM

                                   Mysql 语句解析 (可以查看索引的使用与否 以及执行解析)

  语句前加 explain 

例如:

explain  select * from art
结果:

 具体参数含义请看

https://www.cnblogs.com/xuanzhi201111/p/4175635.html


猜你喜欢

转载自blog.csdn.net/qq_35786291/article/details/80968214