随笔分类 - MySQL
摘要:触发器:trigger 触发器是与表有关的数据库对象,指在 insert/update/delete 之前或之后,触发并执行触发器中定义的SQL语句集 合。 语法: create trigger trigger_name before|after insert|update|delete on ta
阅读全文
摘要:MySQL 存储过程 4)case结构 方法一: case value when value then sql语句01 when value then sql语句02 else sql语句03 end case 方法二: case when 条件语句 then sql语句01 when 条件语句 t
阅读全文
摘要:视图概述 视图(View)是一种虚拟存在的表。视图并不在数据库中实际存在,行和列数据来自定义视图的查询中使用的表, 并且是在使用视图时动态生成的。通俗的讲,视图就是一条SELECT语句执行后返回的结果集。所以我们在创建视 图的时候,主要的工作就落在创建这条SQL查询语句上。 select * fro
阅读全文
摘要:create database demo_01 default charset=utf8mb4; use demo_01; CREATE TABLE `city` ( `city_id` int(11) NOT NULL AUTO_INCREMENT, `city_name` varchar(50)
阅读全文
摘要:Linux 命令在线手册https://www.linuxcool.com MySQL 四部曲https://www.cnblogs.com/cxuanBlog/p/13173547.html 入门https://www.cnblogs.com/cxuanBlog/p/13352975.html 进
阅读全文
摘要:#!/bin/bash#echo "vm.swappiness = 0">> /etc/sysctl.confswapoff -a && swapon -asysctl -psystemctl stop firewalld.servicesystemctl disable firewalld.ser
阅读全文
摘要:Apache Superset BI yum install -y yum-utils device-mapper-persistent-data lvm2yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux
阅读全文
摘要:Navicat 连接Mysql 8.0以上版本报错12511251-Client does not support authentication protocol requested by server; 解决办法: 更改加密方式:ALTER USER 'root'@'localhost' IDEN
阅读全文
摘要:相信很多使用sql2000,mssql的朋友都对日志文件过大严重影响数据库运行,数据文件只有1G,但长期的数据库日志文件却有10G了,因为数据比较重要,有些手段又不好使用. 因为使用收缩数据库并不好使用.收缩日志文件也没有多大效果.笔者这里介绍一个最安全的减小mssql数据库日志文件的方法: 1.首
阅读全文
摘要:下载安装包mysql-8.0.23-1.el7.x86_64.rpm-bundle.tar。wget https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.23-1.el7.x86_64.rpm-bundle.tar 解压安装包tar -xv
阅读全文
摘要:导出数据 1、备份全部数据库的数据和表结构mysqldump -uroot -ppassword -A >all.sql 2、只备份表结构,不备份数据mysqldump -uroot -ppassword -A -d > database.sql 3、只备份数据库,不备份表结构mysqldump -
阅读全文
摘要:mysqldump 备份导出数据排除某张表 就用 --ignore-table=dbname.tablename参数就行,可以忽略多个。 /usr/bin/mysqldump --set-gtid-purged=OFF -h127.0.0.1 -uroot -p123456 dbname --ign
阅读全文
摘要:GRANT REPLICATION SLAVE ON *.* TO 'user-xxx'@'172.10.10.11' IDENTIFIED BY 'xxxxx'; flush privileges;show master status\G; change master to master_host
阅读全文
摘要:mysql> drop view grade_view' '> \q '> \quit '> quit '> exit '> \c '> \ '> ; '> ; '> ; '> ; '> ; '> ; '> ; '> ; '> ; '> 可以在原基础上输入’\q'> '\qBye 换个命令:’\cm
阅读全文
摘要:Linux 安装 MySQL-5.7.23 yum -y install wget cmake gcc gcc-c++ ncurses ncurses-devel libaio-devel openssl openssl-develyum install -y libaio libaio-devel
阅读全文
摘要:1、编译安装MySQL8.0 版本信息 #cat /etc/redhat-releaseCentOS Linux release 7.5.1804 (Core) 安装依赖包 yum -y install wget cmake gcc gcc-c++ ncurses ncurses-devel lib
阅读全文
摘要:可以使用 --ignore-table=dbname.tablename 忽略一张表 /usr/bin/mysqldump --set-gtid-purged=OFF -h127.0.0.1 -uroot -p'密码' 数据库名 --ignore-table=数据库名.表名 > 自定义名称.sql
阅读全文
摘要:SELECT INTO OUTFILE LOAD DATA INFILE mysqlimport SELECT INTO OUTFILE > help select; Name: 'SELECT' Description: Syntax: SELECT [ALL | DISTINCT | DISTI
阅读全文
摘要:转摘:https://www.cnblogs.com/wxzhe/p/11459777.html 数据库宕机触发VIP漂移 HAPROXY状态触发VIP漂移 这片文章主要介绍mysql+haproxy+keepalived的高可用使用。 有两种模式: 第一种:数据库宕机触发VIP漂移的高可用使用。
阅读全文
摘要:表管理和索引,外键作用:创建数据库create schema if not exists students character set 'gbk' collate 'gbk_chinese_ci';cd students lsfile db.optcat db.optdefault-characte
阅读全文