Run the Docker daemon as a non-root user
Run the Docker daemon as a non-root user To create the docker group and add your user: Create the docker group. sudo groupadd docker Add your user to the docker group. sudo usermod -aG docker $USER Log out and log back in so that your group membership is re-evaluated. If you're running Linux in a virtual machine, it may be necessary to restart the virtual machine for changes to take effect. You can also run the following command to activate the changes to groups: newgrp docker Ver...
Import and Export on MySQL
Import and Export on MySQL outfile 命令导出表数据 SELECT @@secure_file_priv;SELECT * FROM wiki.table1 INTO OUTFILE '/var/lib/mysql-files/wiki_table1' FIELDS TERMINATED BY '---'; mysql 命令导出表数据 mysql -ujove -pjove -e 'select * from wiki.table1' > /backup/wiki_table1mysql -ujove -pjove --xml -e 'select * from wiki.table1' > /backup/wiki_table1.xmlmysql -ujove -pjove --html -e 'select * from wiki.table1' > /backup/wiki_table1.html 备份表结构 mysqldump -ujove -pjove -d wiki table1 > /backup...
Percona XtraBackup 2.4(EOL)
Percona XtraBackup 2.4(EOL) Percona XtraBackup 2.4.29 is the final release of the Percona XtraBackup 2.4 series. Percona XtraBackup 2.4 does not support making backups of databases created in MySQL 8.0 or higher. Full Backup # 备份mkdir -p /xtarbackup/fullinnobackupex --user=root --password='welcome' /xtarbackup/full# 停止MySQL服务,删除数据systemctl stop mysqldrm -rf /var/lib/mysql/*rm -rf /var/log/mysqld.logrm -rf /var/log/mysql-slow/slow.log# 备份还原innobackupex --apply-log /xtarbackup/full/2022-01-01...
mysqldump
mysqldump Backup mysqldump -uroot -p'welcome' \--all-databases \--single-transaction \--routines \--source-data=1 \--flush-logs > backup.sql Restore # 设置还原时不记录binlog日志sed -i '1i set sql_log_bin=0;' backup.sqlmysql -uroot -p'welcome@123' < backup.sqlmysqlbinlog --start-position=154 binlog.00003 binlog.00004 | mysql -uroot -p'welcome@123'systemctl restart mysqld --stop-position, --start-position 误删除时,可以用来跳过误删除语句
Using LVM Snapshot to Backup MySQL
Using LVM Snapshot to Backup MySQL 数据库全局读锁 flush tables with read lock; LVM 快照 lvcreate -L 500M -s -n mysql-snap /dev/datavg/mysql-snap mysql -uroot -p'Jove@123' -e 'show master status' > /backup/date +%F_position.log 释放全局读锁(关闭全局锁会话时,锁将自动失效) unlock tables; 挂载快照卷(只读) 从快照卷中复制数据(cp/tar) 卸载并删除快照卷 #! /bin/bash# LVM Snapshot for mysql backupbackup_dir=/backup/`date +%F`[ -d $backup_dir ] || mkdir -p $backup_direcho "FLUSH TABLES WITH READ LOCK; \SYSTEM lvcreate -L 500M -s -n mysql-snap /dev...
Master-Slave Replication on MySQL 5.7.13
Master-Slave Replication on MySQL 5.7.13 Architecture All database operations are copied to the master’s binary log. Salves connect to the master and asks for the data. The slave servers get the masters binary log. Slaves then apply the binary log to its realy log. The relay log is read by the SQL thread process and it applies all the operations/data to the slave’s database and its binary log. Configuration Procedures Setup on Master 配置主机名解析。 "/etc/hosts"172.17.0.3 db2c998a052d ...
Percona XtraDB Cluster
Percona XtraDB Cluster Examples: Node Host IP Node 1 node1.localhost 192.168.184.161 Node 2 node2.localhost 192.168.184.162 Node 3 node3.localhost 192.168.184.163 Prerequisites Make sure that the following ports are not blocked by firewall or used by other software. Percona XtraDB Cluster requires them for communication. • 3306 • 4444 • 4567 • 4568 The SELinux security module can constrain access to data for Percona XtraDB Cluster. The best solution is to change the mode from...
ERROR 2059 (HY000)
ERROR 2059 (HY000) SYMPTOMS 客户端远程连接数据库时出现验证错误 ERROR 2059 (HY000): Authentication plugin 'caching_sha2_password' cannot be loaded: No such file or directory CASE 该原因是 MySQL8 以后,加密规则是 caching_sha2_password,MySQL8 以前加密规则是 mysql_native_password SOLUTION 修改 my.cnf 文件,将加密规则改为 mysql_native_password,重启服务 sed -i '/\[mysqld\]/a default_authentication_plugin=mysql_native_password' my.cnf 重置密码,刷新权限 alter user 'root'@'%' identified by 'new_pass' password expire never;alter user 'root'@'%' identifi...
MY-011906
MY-011906 SYMTOMS MySQL8 服务器意外掉电,启动时报错: InnoDB: End of page dump InnoDB: Page may be an update undo log page 2021-02-10T14:22:14.800611Z 0 [ERROR] [MY-011906] [InnoDB] Database page corruption on disk or a failed file read of page [page id: space=4294967279, page number=611]. You may have to recover from a backup. SOLUTION 添加 innodb_force_recovery 参数,重新启动数据库进入恢复模式 [mysqld]innodb_force_recovery = 1 1 (SRV_FORCE_IGNORE_CORRUPT): 忽略检查到的 corrupt 页。尽管检测到了损坏的 page 仍强制服务运行。一般设置为该值即可,然后 dump 出...
ORA-15274 Not enough failgroups (3) to create voting files
ORA-15274 Not enough failgroups (3) to create voting files APPLIES TO Operating System - Oracle Linux Server 7.9 Oracle Database - Enterprise Edition - version 11.2.0.3.0 Oracle Grid Infrastructure - version 11.2.0.3.0 SYMPTOMS 安装 GI 软件,节点 1 执行 root.sh 时,出现如下错误: clscfg: -install mode specifiedSuccessfully accumulated necessary OCR keys.Creating OCR keys for user 'root', privgrp 'root'..Operation successful.Failed to create voting files on disk group OCR.Change to configuration failed, bu...














