docker定时任务Mysql脚本
#!/bin/bash # 定义备份参数 number=31 backup_dir=/root/mysqlbackup dd=`date +%Y-%m-%d` tool=docker exec -i mysql mysqldump username=root password=123456 database_name=dbname # 如果备份目录不存在,则创建 if [ ! -d $backup_dir ]; then mkdir -p $backup_dir; fi # 执行mysqldump命令备份数据库 docker exec -i mysql mysqldump -u$username -p$password. $database_name>$backup_dir/bangong_$dd.sql # 记录备份日志 echo "create $backup_dir/$database_name-$dd.sql...
docker安装mysql8注意事项
my.cnf [mysqld] lower-case-table-names=1 log-bin=/var/lib/mysql/mysql-bin server-id=1 binlog_expire_logs_seconds=259200 pid-file = /var/run/mysqld/mysqld.pid socket = /var/run/mysqld/mysqld.sock datadir = /var/lib/mysql secure-file-priv= NULL character_set_server=utf8 collation-server=utf8_general_ci max_connections=1000 [client] default-character-set=utf8 docker-compose.yml version : '3' services: mysql: ...
.NET8 Mysql SSL error
参考 dockerfile: #See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging. FROM mcr.microsoft.com/dotnet/aspnet:7.0 COPY --from=mcr.microsoft.com/dotnet/aspnet:8.0 /usr/share/dotnet /usr/share/dotnet #USER app WORKDIR /app EXPOSE 80 COPY ./bin/Release/net8.0/publish . ENTRYPOINT ["dotnet", "web.pc.dll"]
定时备份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....