随笔分类 -  MySQL

摘要:1.查看正在执行的SQL语句的id show processlist; 2.停止对应id的SQL语句 kill id 阅读全文
posted @ 2021-02-24 17:22 orcl 阅读(1910) 评论(0) 推荐(0) 编辑
摘要:select current_timestamp from dual; select current_timestamp(); select current_time from dual; select current_time(); select current_date from dual; s 阅读全文
posted @ 2021-01-08 17:30 orcl 阅读(1498) 评论(0) 推荐(0) 编辑
摘要:背景: 导出数据库test库的test表数据出现报错信息:mysqldump: [ERROR] unknown variable 'database=test'. 原来是my.cnf参数文件配置了以下内容: [client] user=test port=3306 database=test 将da 阅读全文
posted @ 2020-12-08 17:47 orcl 阅读(1644) 评论(0) 推荐(0) 编辑
摘要:mysql数据库长时间未操作自动断开连接由参数:interactive_timeout和wait_timeout控制,默认都是8小时(28800分钟) mysql> show variables like '%timeout%'; + + + | Variable_name | Value | + 阅读全文
posted @ 2020-12-08 16:43 orcl 阅读(2959) 评论(1) 推荐(2) 编辑
摘要:1、修改参数文件添加以下内容 skip-grant-tables 2、关闭数据库 [root@node01 ~]# /etc/init.d/mysqld8 stop Shutting down MySQL. SUCCESS! 3、重启数据库 [root@node01 ~]# /etc/init.d/ 阅读全文
posted @ 2020-11-12 10:10 orcl 阅读(80) 评论(0) 推荐(0) 编辑
摘要:一、主从同步报错 mysql> show slave status\G; *************************** 1. row *************************** Slave_IO_State: Waiting for master to send event M 阅读全文
posted @ 2020-11-04 14:58 orcl 阅读(1317) 评论(0) 推荐(0) 编辑
摘要:升级前准备: [root@node01 ~]# mysql -V mysql Ver 14.14 Distrib 5.7.25, for linux-glibc2.12 (x86_64) using EditLine wrapper # 进入原5.7 mysql命令行 正确关闭数据库 mysql> 阅读全文
posted @ 2020-11-03 17:31 orcl 阅读(189) 评论(0) 推荐(0) 编辑
摘要:一、配置组复制的步骤 1、初始化数据目录 2、配置主服务器(primary) 3、配置辅助服务器(secondaries) 4、启动mysql实例 5、安装组复制插件(primary and secondaries) 6、创建复制用户(replication user)的用户 7、在主服务器上启动组 阅读全文
posted @ 2020-09-29 01:04 orcl 阅读(955) 评论(0) 推荐(0) 编辑
摘要:一、背景 原数据库数据目录:/data/mysql3306/data,日志文件目录:/data/mysql3306/binlog 变更后数据库目录:/mysqldata/3306/data,日志文件目录:/mysqldata/3306/binlog 二、操作过程 1、创建测试数据,并停止原库 [ro 阅读全文
posted @ 2020-09-26 11:40 orcl 阅读(299) 评论(0) 推荐(0) 编辑
摘要:一、背景 原数据库数据目录:/data/mysql3306/data,日志文件目录:/data/mysql3306/binlog 变更后数据库目录:/mysqldata/3306/data,日志文件目录:/mysqldata/3306/binlog 二、操作过程 1、停止原库 [root@node0 阅读全文
posted @ 2020-09-26 10:58 orcl 阅读(1958) 评论(0) 推荐(0) 编辑
摘要:1. 主从复制解释 主数据库的增删改等操作记录到二进制日志文件中,从库接收主库日志文件,根据日志最后一次更新的起始位置,复制到从数据库中,使得主从数据库保持一致。 主从复制又有异步复制和半同步复制。 2. 主从复制的作用 高可用性:主数据库异常可切换到从数据库 负载均衡:实现读写分离 备份:进行日常 阅读全文
posted @ 2020-09-25 17:50 orcl 阅读(121) 评论(0) 推荐(0) 编辑
摘要:背景: 主库: 192.168.211.128 从库: 192.168.211.129 一、关闭防火墙 [root@node01 ~]# systemctl disable firewalld [root@node01 ~]# systemctl stop firewalld [root@node0 阅读全文
posted @ 2020-09-25 17:03 orcl 阅读(873) 评论(0) 推荐(0) 编辑
摘要:一、关闭防火墙 [root@node01 ~]# systemctl disable firewalld [root@node01 ~]# systemctl stop firewalld [root@node01 ~]# systemctl status firewalld ● firewalld 阅读全文
posted @ 2020-09-25 15:29 orcl 阅读(132) 评论(0) 推荐(0) 编辑
摘要:#!/bin/bash mysql_user="root" mysql_password="mysqlpassword" mysql_host="192.168.12.30" mysql_port="3306" backup_dir=/mysql/fullbackup base_dir=/usr/l 阅读全文
posted @ 2020-09-07 17:11 orcl 阅读(123) 评论(0) 推荐(0) 编辑
摘要:一、环境 主库(node01):192.168.12.35 端口:3306 从库(node02):192.168.12.36 端口:3306 vip:192.168.12.38 主库,主从数据库服务器已搭建MySQL主从。 2、配置keepalived实现MySQL主从高可用 keepalived配 阅读全文
posted @ 2020-08-21 10:47 orcl 阅读(370) 评论(0) 推荐(0) 编辑
摘要:1、关闭防火墙 [root@node04 ~]#systemctl disable firewalld [root@node04 ~]#systemctl stop firewalld [root@node05 ~]#systemctl disable firewalld [root@node05 阅读全文
posted @ 2020-08-02 18:42 orcl 阅读(471) 评论(0) 推荐(0) 编辑
摘要:1.环境规划 192.168.12.131 node01 192.168.12.132 node02 192.168.12.133 node03 2.环境准备 一主两从GTID,略。 3.配置关键程序软连接(所有节点) ln -s /usr/local/mysql/bin/mysqlbinlog / 阅读全文
posted @ 2020-07-11 19:58 orcl 阅读(565) 评论(0) 推荐(0) 编辑
摘要:[mysql@node3 ~]$ masterha_check_repl --conf=/etc/mha/app1.cnf Tue Jul 7 22:43:26 2020 - [warning] Global configuration file /etc/masterha_default.cnf 阅读全文
posted @ 2020-07-07 22:49 orcl 阅读(737) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示