首页
工具
隐私协议
作品
更多
关于我们
Search
1
FlexboxLayout+recyclerView实现自动换行
1,037 阅读
2
proguard-rules出现unresolved class name
975 阅读
3
onActivityResult过时了,registerForActivityResult使用方法
965 阅读
4
android5遇到INSTALL_FAILED_DEXOPT 解决办法
690 阅读
5
Room数据库Schema export Error
654 阅读
默认分类
mysql
android
android深入
Jetpack Compose
Android传感器
php
Yii2
windows
webrtc
登录
Search
标签搜索
android
kotlin
webrtc
kurento
mysql
nginx
flutter
adb
rsa
微信
git
Yii2
md5
加密
dart
aes
wechat
windows
小程序
dexopt
Kornan
累计撰写
76
篇文章
累计收到
3
条评论
首页
栏目
默认分类
mysql
android
android深入
Jetpack Compose
Android传感器
php
Yii2
windows
webrtc
页面
工具
隐私协议
作品
关于我们
搜索到
2
篇与
mysql
的结果
2023-04-25
查询数据库大小
查询所有数据库的总大小查询数据库大小:use information_schema; select concat(round(sum(DATA_LENGTH/1024/1024),2),'MB') as data from TABLES;统计一下所有库数据量 每张表数据量=AVG_ROW_LENGTH*TABLE_ROWS+INDEX_LENGTHSELECT SUM(AVG_ROW_LENGTH*TABLE_ROWS+INDEX_LENGTH)/1024/1024 AS total_mb FROM information_schema.TABLES 统计每个库大小:SELECT table_schema,SUM(AVG_ROW_LENGTH*TABLE_ROWS+INDEX_LENGTH)/1024/1024 AS total_mb FROM information_schema.TABLES group by table_schema; 查看指定数据库的大小use information_schema; select concat(round(sum(DATA_LENGTH/1024/1024),2),'MB') as data from TABLES where table_schema='test';1.查看所有数据库各容量大小select table_schema as '数据库', sum(table_rows) as '记录数', sum(truncate(data_length/1024/1024, 2)) as '数据容量(MB)', sum(truncate(index_length/1024/1024, 2)) as '索引容量(MB)' from information_schema.tables group by table_schema order by sum(data_length) desc, sum(index_length) desc;2.查看所有数据库各表容量大小select table_schema as '数据库', table_name as '表名', table_rows as '记录数', truncate(data_length/1024/1024, 2) as '数据容量(MB)', truncate(index_length/1024/1024, 2) as '索引容量(MB)' from information_schema.tables order by data_length desc, index_length desc;3.查看指定数据库容量大小例:查看mysql库容量大小select table_schema as '数据库', sum(table_rows) as '记录数', sum(truncate(data_length/1024/1024, 2)) as '数据容量(MB)', sum(truncate(index_length/1024/1024, 2)) as '索引容量(MB)' from information_schema.tables where table_schema='mysql'; 4.查看指定数据库各表容量大小例:查看mysql库各表容量大小select table_schema as '数据库', table_name as '表名', table_rows as '记录数', truncate(data_length/1024/1024, 2) as '数据容量(MB)', truncate(index_length/1024/1024, 2) as '索引容量(MB)' from information_schema.tables where table_schema='mysql' order by data_length desc, index_length desc;
2023年04月25日
27 阅读
0 评论
0 点赞
2020-04-10
设置max_connections无效
在/etc/mysql/my.cnf中设置max_connections=512进入Mysql查看发现还是214mysql> show global variables like '%max_connecti%'; +-----------------+-------+ | Variable_name | Value | +-----------------+-------+ | max_connections | 214 | +-----------------+-------+ 1 row in set (0.01 sec)google了一番后,说是跟open_files_limit有关,每个connect都会打开几个文件,查了下open_files_limit为1024。mysql> show global variables like '%open_files_limit%'; +------------------+-------+ | Variable_name | Value | +------------------+-------+ | open_files_limit | 1024 | +------------------+-------+ 1 row in set (0.00 sec)在/etc/mysql/my.cnf中加上open_files_limit = 4096重启mysql后查看mysql> show global variables like '%max_connecti%'; +-----------------+-------+ | Variable_name | Value | +-----------------+-------+ | max_connections | 512 | +-----------------+-------+ 1 row in set (0.01 sec)mysql> show global variables like '%open_files_limit%'; +------------------+-------+ | Variable_name | Value | +------------------+-------+ | open_files_limit | 4096 | +------------------+-------+ 1 row in set (0.00 sec)open_files_limit最大值也是有限制的,设置太大也会变成默认1024,可以在/etc/security/limits.conf加上并重启系统* soft nofile 65536 * hard nofile 65536还有就是启动mysql的service加上LimitNOFILE=65535并重启mysql,这样可以解除open file的限制,LimitNOFILE=65535
2020年04月10日
251 阅读
0 评论
0 点赞