mysql 查询数据库参数命令】的更多相关文章

1.select @@tx_isolation;    查询数据库设置的事务隔离级别 2.desc table_name;  显示表设计 3.show create table table_name; 显示建表语句…
特:不重启mysql 更新配置文件方法(不允许重启mysql实例或连接不上msyql服务器): gdb -p $(pidof mysqld) -ex "set max_connections=1500" -batch 导出 : 1)mysqldump -uroot -proot --opt 库名 表名> "d:\data1.sql" mysqldump -u root -p --no-data 库名 表名 >D:\P\data.sql Mysqldump…
每个mysql都有一个库information_schema,里面有一张表TABLES存储了所有数据库表的信息,因此,可以从这张表中查看数据库大小和表大小 查询数据库大小 ,),'GB') as data from information_schema.tables where table_schema='esb'; 查询数据库中表大小 ,),'GB') as data from information_schema.tables where table_schema='esb' and tab…
转载:https://www.cnblogs.com/diandiandidi/p/5582309.html 1.要查询表所占的容量,就是把表的数据和索引加起来就可以了 select sum(DATA_LENGTH)+sum(INDEX_LENGTH) from information_schema.tables where table_schema='数据库名'; 上面获取的结果是以字节为单位的,可以通过%1024在%1024的到M为单位的结果. 2.查询所有的数据大小 select conc…
查询数据库中所有表名select table_name from information_schema.tables where table_schema='csdb' and table_type='base table'; 查询指定数据库中指定表的所有字段名column_nameselect column_name from information_schema.columns where table_schema='csdb' and table_name='users'…
由人说mysql查询缓存是鸡肋,也许吧,但还是要看场景: 查询缓存: 开启查询缓存:/etc/my.cnfquery_cache_type=1 重启…
查询数据库的占用 SELECT CONCAT(ROUND(SUM(index_length)/(1024*1024), 2), ' MB') AS 'Total Index Size' , CONCAT(ROUND(SUM(data_length)/(1024*1024), 2), ' MB') AS 'Total Data Size' FROM information_schema.TABLES where  table_schema like 'edb_a%' ; 查询表的占用 SELECT…
SELECT TABLE_NAME '表名',TABLE_SCHEMA '数据库名',ORDINAL_POSITION '顺序',COLUMN_NAME '字段',DATA_TYPE '类型' ,CHARACTER_OCTET_LENGTH '字节长',IF(COLUMN_KEY='PRI',"√","") '主键',IF(EXTRA='auto_increment',"√","") '自增长' ,IF(IS_NULLABLE…
#倒序查询数据库[各表记录数] use information_schema; select table_name,table_rows from tables where TABLE_SCHEMA = '数据库名' order by table_rows desc;…
查询数据库中所有表名select table_name from information_schema.tables where table_schema='数据库名' and table_type='base table';查询指定数据库中指定表的所有字段名column_nameselect column_name from information_schema.columns where table_schema='数据库名' and table_name='表名'; #查看分布式系统中不同…
查询数据库中所有表名 select table_name from information_schema.tables where table_schema='csdb' and table_type='base table'; 查询指定数据库中指定表的所有字段名 select column_name from information_schema.columns where table_schema='csdb' and table_name='users';…
写在前面: 因为工作时候经常遇到半路接手项目的情况,由于年代久远,数据库字典这块经常缺失.故写此篇,以便复用,也希望对大家有点帮助. 随笔内容不高级,如有不妥,不吝指正. 20190730-加了一些简单样式,生成的excel文件,只需要人为操作设置列宽度自适应,样式就基本ok了: ------------------------------------------------------------分-割-线--------------------------------------------…
第一步:首先打开Mysql命令行,通过开始菜单-程序-MySql-Command line client,如图1-1所示: 图1-1 第二步:在命令中输入use information_schema 如图1-2所示: 图1-2 第三步:查看指定数据库的大小,输入如下语句:  select concat(round(sum(DATA_LENGTH/1024/1024),2), 'MB') as data from TABLES where table_schema= 'offlineCollect…
1. MySQL数据库表中有两个时间的字段,需要计算他们的时间差: (1)datediff函数来表示时间差. 基本语法: DATEDIFF(datepart,startdate,enddate) 说明: datepart可以指定时间单位,天,小时,分钟等,但是 经过我试验, DATEDIFF(startdate,enddate),不能指定天,时,分,秒等参数, 似乎只能计算天数差 例子: SELECT DATEDIFF(day,'2008-12-29','2008-12-30') SELECT …
1.查询sjcenter数据库里开头为sj_demo和sj_onlyinv的所有表的总条数 select sum(table_rows) from (select table_name,table_rows from tables  where TABLE_SCHEMA = 'sjcenter'  order by table_rows desc) as b where b.table_name like 'sj_demo%' or b.table_name like 'sj_onlyinv'…
使用MySQL时,需要了解当前数据库的情况,例如当前的数据库大小.字符集.用户等等.下面总结了一些查看数据库相关信息的命令 1:查看显示所有数据库 mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | INVOICE | | mysql | | performance_schema | | test | +----------------…
Mysql版本: 登入数据库的时候: select @@version; select version(); mysql> select @@version; +-----------+ | @@version | +-----------+ | 5.5.53 | +-----------+ 1 row in set (0.00 sec) mysql> select version(); +-----------+ | version() | +-----------+ | 5.5.53 |…
#======================================================================= #查询表信息 select table_name, table_comment, create_time, update_time from information_schema.tables where table_schema = (select database()); #=====================================…
1.查看数据库表数量SELECT count(TABLE_NAME) FROM information_schema.TABLES WHERE TABLE_SCHEMA='dbname';  2.获取mysql下所有数据库表的数量 SELECT COUNT(*) TABLES, table_schema FROM information_schema.TABLES GROUP BY table_schema; 3.获取指定数据库的表的数量 SELECT COUNT(*) TABLES, tabl…
一.查询所有数据库占用空间大小 SELECT TABLE_SCHEMA, CONCAT( TRUNCATE(SUM(data_length) / 1024 / 1024, 2), ' MB' ) AS data_size, CONCAT( TRUNCATE(SUM(index_length) / 1024 / 1024, 2), 'MB' ) AS index_size FROM information_schema.tables GROUP BY TABLE_SCHEMA ORDER BY d…
1. mysql> describe tmp_log; +----------+------------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +----------+------------------+------+-----+---------+----------------+ | id | int(20) unsigned | NO |…
积累备忘啊: ; 从t_maintenanceinfo表查询重复记录的mtiId 和ip字段,以及重复条数…
一.       查询数据: 查询所有列:SELECT * FROM student; 查询指定列:SELECT id,NAME,gender FROM student; 格式:select字段名, 字段名, 字段名 from 表名 查询时添加常量列: 在查询xxx表时添加一个班级列,内容为“xxx” SELECT id,NAME,gender,age,'xxx' AS '年级'  FROM xxx; 查询时合并列: 需求: 查询每个学生的servlet和jsp的总成绩 SELECT id,NA…
select table_name,table_rows from information_schema.tables where TABLE_SCHEMA = '数据库名称' order by table_rows desc;…
SELECT * FROM information_schema.`TABLE_CONSTRAINTS` where TABLE_SCHEMA='mold' and TABLE_NAME='tplminvbase';…
1.建表语句sys_user CREATE TABLE `sys_user` ( `id` varchar(32) NOT NULL COMMENT '编号', `dept_id` varchar(32) DEFAULT NULL COMMENT '部门', `login_name` varchar(50) NOT NULL COMMENT '登录名', `password` varchar(100) NOT NULL COMMENT '密码', `salt` varchar(20) NOT N…
SELECT TABLE_NAME,DATA_LENGTH+INDEX_LENGTH,TABLE_ROWS,concat(round((DATA_LENGTH+INDEX_LENGTH)//,), 'MB') as data FROM information_schema.tables WHERE TABLE_SCHEMA='test' ORDER BY DATA_LENGTH+INDEX_LENGTH desc; 结果展示:…
#coding:utf-8 ''' Created on 2017年10月25日 @author: li.liu ''' import pymysql db=pymysql.connect('localhost','root','root','test',charset='utf8') m=db.cursor() ''' try: #a=raw_input('请输入sql语句'+'\n') m.execute('select * from student') a=m.fetchall() b=m…
select table_name from information_schema.columns where table_schema = '库名' and column_name='字段名';  …
mysql数据库使用总结 本文主要记录一些mysql日常使用的命令,供以后查询. 1.更改root密码 mysqladmin -uroot password 'yourpassword' 2.远程登陆mysql服务器 mysql -uroot -p -h192.168.137.10 -P3306 3.查询数据库 show databases; 4.进入某个数据库 use databasename; 5.列出数据库中的表 show tables; 6.查看某个表全部字段 desc slow_log…