摘要: 备份必加参数: -R:在备份时,同时备份存储过程和函数,相当于linux的shell脚本 -E:在备份时,同时备份event,相当于linux里的定时备份命令crontab --triggers:在备份时同时备份触发器, --master-data=2:记录备份开始时的position号,可作为将来 阅读全文
posted @ 2021-02-01 18:20 linuxTang 阅读(126) 评论(0) 推荐(0) 编辑
摘要: 优化相关的日志-slowlog 作用:记录慢SQL语句的日志,定位低效SQL语句的工具日志 开启慢日志:slow_query_log=1 慢日志文件的位置:slow_query_log_file=/data/mysql/slow.log 设定慢查询时间为0.1秒:long_query_time=0. 阅读全文
posted @ 2021-02-01 14:56 linuxTang 阅读(856) 评论(0) 推荐(0) 编辑
摘要: 1查看有多少个事务 3号文件里有372个事务 mysql> show master status; + + + + + + | File 3号文件 | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set 本机一共运行了372个 阅读全文
posted @ 2021-02-01 11:22 linuxTang 阅读(639) 评论(0) 推荐(0) 编辑
摘要: 一,故障处理(小插曲): 不小心把目录/data/mysql/data下的表空间文件ibdata1删除了,幸好我做了回收站,将回收站中的ibdata1恢复至原目录后,需要执行一个重启命令systemctl restart mysqld后才能登陆数据库 二,演示恢复表空间 1开启一个新的3307端口的 阅读全文
posted @ 2021-01-26 10:07 linuxTang 阅读(158) 评论(0) 推荐(0) 编辑
摘要: 一,批量删除表空间数据idb文件: 1使用navicat导入world.sql数据库,并备份数据库 [root@instance-r5y0pf5d ~]# cp -r /data/mysql/data/world /data/mysql/data/world.bak 2批量生成删除表空间语句: my 阅读全文
posted @ 2021-01-21 16:45 linuxTang 阅读(224) 评论(0) 推荐(0) 编辑
摘要: mysql> desc select * from oldboy.t_100w where k2='EF12'\G *************************** 1. row *************************** id: 1 select_type: SIMPLE tab 阅读全文
posted @ 2021-01-19 18:32 linuxTang 阅读(122) 评论(0) 推荐(0) 编辑
摘要: 1单库统计数据: select table_schema,sum(AVG_ROW_LENGTH*TABLE_ROWS+INDEX_LENGTH)/1024/1024 as mb from information_schema.tables group by table_schema; 2导出所有库中 阅读全文
posted @ 2021-01-18 18:45 linuxTang 阅读(70) 评论(0) 推荐(0) 编辑
摘要: 1concat()的作用: 可以实现拼接命令 mysql> select user,host from mysql.user; + + + | user | host | + + + | root | % | | tyjs09 | % | | zhihu | 10.0.0.% | | root | 阅读全文
posted @ 2021-01-18 18:18 linuxTang 阅读(56) 评论(0) 推荐(0) 编辑
摘要: nginx有四个版本,开源nginx版,商业nginx plus版,淘宝tengine分支版,和openresty扩展板 其中商业版收费,淘宝版是阿里针对nginx的高并发二次开发的项目,而扩展版和淘宝版有着异曲同工之妙,个人感觉扩展板性能更强悍一些。 1使用dockerfile制作一个nginx扩 阅读全文
posted @ 2021-01-17 13:50 linuxTang 阅读(73) 评论(0) 推荐(0) 编辑
摘要: 1information_schema就是一个全局虚拟库,库内有很多视图,在mysql启动时自动生成: mysql> show databases; + + | Database | + + | information_schema | | #mysql50#20210113-1817 | | my 阅读全文
posted @ 2021-01-14 18:41 linuxTang 阅读(210) 评论(0) 推荐(0) 编辑