mysql自带的infomation库
在mysql中,可用“select count(*) from information_schema.tables where table_schema=数据库 and table_name=表名”查询
如果count大于0,则说明表存在。
另外,可以直接使用 select * ….. 如果表存在,则返回表结构,例如:
select * from information_schema.tables where table_schema='bishe_tiku' and table_name='option'
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME TABLE_TYPE ENGINE VERSION ROW_FORMAT TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE AUTO_INCREMENT CREATE_TIME UPDATE_TIME CHECK_TIME TABLE_COLLATION CHECKSUM CREATE_OPTIONS TABLE_COMMENT
def bishe_tiku option BASE TABLE InnoDB 10 Dynamic 2 8192 16384 0 0 0 3 2022-05-15 16:16:52 utf8mb4_general_ci