定时备份docker中的mysql
docker exec mysql /bin/bash -c 'mysqldump -uroot -pPASSWORD --databases confluence ' >/mnt/home/brucehe/confluence/backup/confluence_`date +%F`.sql; gzip /mnt/home/brucehe/confluence/backup/confluence_`date +%F`.sql; crontab表达试: sudo crontab -e 0 1 * * * backupmysql.sh #每天晚上1点执行 注意:一定要删除命令(docker exec -it)中的 -it, 因为-it会开启新的终端,而cron表达试及service等不支持交互试的命令执行。
docker-compose通过容器名连接mysql
这是Mysql的配置: version :'3' services: desneyMysql: container_name: app_mysql image: mysql:5.7 build: context:./mysql ports: -"3307:3306" volumes: -./mysql/conf:/etc/mysql/conf.d -./mysql/logs:/logs -./mysql/data:/var/lib/mysql command:[ 'mysqld', '--innodb-buffer-pool-size=80M', '--character-set-server=utf8mb4', '--collation-server=utf8mb4_unicode_ci', '--default-time-zone=+8:00', '--lower-case-table-names=1' ] environment: MY...
unity3d mysql error: The given key was not present in the dictionary.
please update(upgrade) your mysql.data.dll to right version.
MySQL 批量修改数据表编码及字符集
一、 修改数据库编码及字符集 修改数据库编码及字符集比较简单: <span class="token keyword">ALTER</span> <span class="token keyword">DATABASE</span> db_name <span class="token keyword">CHARACTER</span> <span class="token keyword">SET</span> <span class="token operator">=</span> utf8mb4 <span class="token keyword">COLLATE</span> <span class=&qu...
Your database must use ‘READ-COMMITTED’ as the default isolation level.
create database confluence default charset utf8 collate utf8_bin; SET GLOBAL TRANSACTION ISOLATION LEVEL READ COMMITTED;
MySQL-InnoDB存储引擎
这个是之前在公司内部做的一个关于MySQL的分享,主要参考了《MySQL技术内幕-InnoDB存储引擎》书籍和极客时间林晓斌的《MySQL实战45讲》课程,然后从中提取了最核心的内容,相信会给需要学习MySQL的同学一些帮助和指导。
将数据从mysql迁移到clickhouse
1、关于clickhouse的介绍 https://zhuanlan.zhihu.com/p/370201180 2、京东使用clickhouse存储秒级100G日志数据: https://new.qq.com/omn/20220408/20220408A03TA600.html 3、将MySQL数据迁徙到clickhouse内操作步骤: #clickhouse-client 🙂 create database newDB; 🙂 use newDB; –导入数据: CREATE TABLE Orders ENGINE = MergeTree ORDER BY OrderID AS SELECT * FROM mysql(‘10.42.134.136:3307’, ‘DBNAME’, ‘Orders’, ‘root’, ‘PASSWORD’); Ok. 0 rows in set. Elapsed: 1832.114 sec....
mysql关于索引那些事儿
1.对查询进行优化,应尽量避免全表扫描,首先应考虑在 where 及 order by 涉及的列上建立索引。 2.查询尽量走索引。可以使用 use index(create_time_index) 或者 force index(create_time_index) 强制走索引。 3.时间字段建索引,有可能反而会很慢。可以使用 ignore index(create_time_index) 强制不走索引 4.使用MAX等函数后不走索引,使用 order by limit 1; 例如(tb_user数据1000W): select max(rank) from tb_user; 需要3秒,但是 select rank from tb_user order by rank desc limit 1;只需要0.01秒。...
mysql大数据表加字段改名
select count(0) from product_detection select count(0) from product_detection_latest create table tmp like product_detection; insert into product_detection_latest select a.id, a.product_id, a.title, a.image_url, a.item_url, a.price, a.rating, a.sub_category, a.reviews_count, a.review_change, a.rank_number, a.country, a.brand, a.source, a.tag, a.category, a.create_time, a.reviews_count_latest, a.rating_latest, a.first_review_day, a.latest_review_day, a.period, a.base...
mysql大数据表添加字段
方案一、 1.创建一个临时的新表,复制旧表的结构 create table `tmp` like `goods`; 2.给新表加上新增的字段 ALTER TABLE `tmp` ADD COLUMN `num` int(10) NOT NULL DEFAULT 0 AFTER `unit`; 3.把旧表的数据复制过来 insert into tmp(id,name,unit) select id,name,unit from goods; 4.重命名 rename table goods to goods_bak; rename table tmp to goods; 方案二、升级MySQL的服务器版本 升级到高版本后 因为引入了新的算法:即时算法 所以会毫秒级别的加字段 不会对业务发布上线造成影响 ...