Fork me on GitHub

随笔分类 -  MySQL

摘要:## zabbix6.0 server端已经不支持centos7 了,故本文章以RockyLinux 9 演示 OS :Rocky Linux release 9.2 (Blue Onyx) Database: Mysql Web Server :Nginx RockyLinux下载地址:https 阅读全文
posted @ 2023-08-18 17:22 Alex-Lzy 阅读(3360) 评论(0) 推荐(0) 编辑
摘要:如手误在从节点上建立个数据库了,主节点上没有这个数据库,是不允许发生这种事情的, 如先在从节点上创建create database a1;,然后在主节点上创建create database a1;一模一样的库的时候 查询服务器状态:show slave status\G 1 show slave s 阅读全文
posted @ 2021-01-18 17:22 Alex-Lzy 阅读(141) 评论(0) 推荐(0) 编辑
摘要:一、备份数据库文件 mysqldump -A --single-transaction --master-data=1 -F > /data/all.sql 二、复制数据库备份文件到从服务器上 scp -r /data/all.sql 192.168.1.10:/data 三、从服务器上,安装数据库 阅读全文
posted @ 2021-01-18 17:06 Alex-Lzy 阅读(83) 评论(0) 推荐(0) 编辑
摘要:主服务器IP地址192.168.1.7 从服务器IP地址192.168.1.10 一主一从 一、修改主服务器的配置文件 vim /etc/my.cnf [mysqld] server-id=1 log_bin=/data/logbin/mysql-bin server-id=1 在主服务器上写上se 阅读全文
posted @ 2021-01-18 16:58 Alex-Lzy 阅读(68) 评论(0) 推荐(0) 编辑
摘要:使用主从服务器的好处是:当主服务器修改了数据,会实时同步到从服务器上,利用主从复制可以在一定的程度上代替备份,但千万不能完全代替备份,因为当你在主服务器上删除表,删除库,从服务器上也会马上删除表删除库。 扩展方式: Scale Up ,Scale Out Scale Up 纵向的:可以理解为买更好的 阅读全文
posted @ 2021-01-12 16:16 Alex-Lzy 阅读(426) 评论(0) 推荐(0) 编辑
摘要:假设不是系统损坏,而是人为损坏,如手误删除表 前提条件: 假设备份的条件是每天凌晨2点开始备份,周一备份正常,现在是周一下午18点,此时你的同事删除了hellodb数据库的中students表,而其他表没有损坏,可以正常访问,此时时间18点20分,用户表示不能访问了, 一、现在开始备份 mysqld 阅读全文
posted @ 2021-01-08 11:50 Alex-Lzy 阅读(312) 评论(0) 推荐(0) 编辑
摘要:模拟数据库在某次备份后但未达到下次备份时间中,被意外删除的数据 此处恢复hello数据库和里面的students表 使用工具:均为mariadb-server自带 1 mysqldump 2 mysqlbinlog 前提条件: 二进制日志文件必须开启 MariaDB [(none)]> show m 阅读全文
posted @ 2021-01-07 18:46 Alex-Lzy 阅读(209) 评论(0) 推荐(0) 编辑