08 2020 档案

摘要:数据库系统使用锁是为了支持对共享资源进行并发访问,提供数据的完整性和一致性。 对于MYISAM引擎,其锁是表锁设计。lock的对象是事务,用来锁定的是数据库中的对象,如表、页、行。并且一般lock的对象仅在事务commit或rollback后进行释放(不同事务隔离级别释放的时间可能不同)。 两种锁, 阅读全文
posted @ 2020-08-25 19:20 wongchaofan 阅读(151) 评论(0) 推荐(0) 编辑
摘要:innodb存储引擎支持以下几种常见的索引: B+树索引 全文索引 哈希索引 其中,innodb支持的索引是只适应的,不能人为的干预是否在一张表中生成哈希索引。 数据库的B+树索引可以分为聚集索引和辅助索引,但是不管是聚集还是辅助的索引,其内部都是B+树的,即高度平衡的,叶子节点存放着所有的数据。聚 阅读全文
posted @ 2020-08-23 18:35 wongchaofan 阅读(159) 评论(0) 推荐(0) 编辑
摘要:对于innodb存储引擎本身而言,提供了以下几种约束: primary key unique key foreign key default not null 约束的创建可以采用以下两种方式: 表建立时就进行约束定义; 利用alter table 命令来进行创建约束。 对于主键约束来说,其默认约束名 阅读全文
posted @ 2020-08-23 09:51 wongchaofan 阅读(184) 评论(0) 推荐(0) 编辑
摘要:SHOW具有许多形式,可提供有关数据库,表,列或有关服务器的状态信息的信息。 SHOW {BINARY | MASTER} LOGS #显示二进制文件 SHOW BINLOG EVENTS [IN 'log_name'] [FROM pos] [LIMIT [offset,] row_count] 阅读全文
posted @ 2020-08-22 03:14 wongchaofan 阅读(134) 评论(0) 推荐(0) 编辑
摘要:linux系统和应用程序可以生成超过30个信号。常用的信号有下面这些。 信号 值 描述 1 SIGHUP 挂起进程 2 SIGINT 终止进程 3 SIGQUIT 停止进程 9 SIGKILL 无条件终止进程 15 SIGTERM 尽可能终止进程 17 SIGSTOP 无条件停止进程,但不是终止进程 阅读全文
posted @ 2020-08-22 01:05 wongchaofan 阅读(143) 评论(0) 推荐(0) 编辑
摘要:linux标准文件描述符 一般情况下,每个 Unix/Linux 命令运行时都会打开三个文件: 标准输入文件(stdin):stdin的文件描述符为0,Unix程序默认从stdin读取数据。 标准输出文件(stdout):stdout 的文件描述符为1,Unix程序默认向stdout输出数据。 标准 阅读全文
posted @ 2020-08-21 04:54 wongchaofan 阅读(189) 评论(0) 推荐(0) 编辑
摘要:Linux read命令用于从标准输入读取数值。 read 内部命令被用来从标准输入读取单行数据。这个命令可以用来读取键盘输入,当使用重定向的时候,可以读取文件中的一行数据。 语法 read [-ers] [-a aname] [-d delim] [-i text] [-n nchars] [-N 阅读全文
posted @ 2020-08-21 02:51 wongchaofan 阅读(214) 评论(0) 推荐(0) 编辑
摘要:Shell 变量 定义变量时,变量名不加美元符号($,PHP语言中变量需要),如: your_name="runoob.com" 注意,变量名和等号之间不能有空格,这可能和你熟悉的所有编程语言都不一样。同时,变量名的命名须遵循如下规则: 命名只能使用英文字母,数字和下划线,首个字符不能以数字开头。 阅读全文
posted @ 2020-08-20 11:31 wongchaofan 阅读(107) 评论(0) 推荐(0) 编辑
摘要:Shell中的 test 命令用于检查某个条件是否成立,它可以进行数值、字符和文件三个方面的测试。 test命令可以用方括号代替,但第一个方括号之后和第二个方括号之前必须得有空格,否则会报错。 数值测试 参数说明 -eq 等于则为真 -ne 不等于则为真 -gt 大于则为真 -ge 大于等于则为真 阅读全文
posted @ 2020-08-20 10:05 wongchaofan 阅读(390) 评论(0) 推荐(0) 编辑
摘要:Linux awk 命令 https://www.runoob.com/linux/linux-comm-awk.html AWK 是一种处理文本文件的语言,是一个强大的文本分析工具。 之所以叫 AWK 是因为其取了三位创始人 Alfred Aho,Peter Weinberger, 和 Brian 阅读全文
posted @ 2020-08-20 03:16 wongchaofan 阅读(117) 评论(0) 推荐(0) 编辑
摘要:sed 流编辑脚本 语法: sed [OPTION]... {script-only-if-no-other-script} [input-file]... 通常调用sed的格式: sed SCRIPT INPUTFILE... 如果指定了标准输入文件,格式大概是这样子: sed ’s/hello/ 阅读全文
posted @ 2020-08-19 07:57 wongchaofan 阅读(416) 评论(0) 推荐(0) 编辑
摘要:CASE语句 CASE case_value WHEN when_value THEN statement_list [WHEN when_value THEN statement_list] ... [ELSE statement_list] END CASE CASE WHEN search_c 阅读全文
posted @ 2020-08-18 08:50 wongchaofan 阅读(152) 评论(0) 推荐(0) 编辑
摘要:Local Variable DECLARE Statement DECLARE var_name [, var_name] ... type [DEFAULT value] 该语句在存储的程序中声明局部变量。要提供变量的默认值,请包含一个 DEFAULT子句。该值可以指定为表达式;它不必是常数。如 阅读全文
posted @ 2020-08-18 08:06 wongchaofan 阅读(134) 评论(0) 推荐(0) 编辑
摘要:[begin_label:] BEGIN [statement_list] END [end_label] [begin_label:] LOOP statement_list END LOOP [end_label] [begin_label:] REPEAT statement_list UNT 阅读全文
posted @ 2020-08-18 07:26 wongchaofan 阅读(108) 评论(0) 推荐(0) 编辑
摘要:[begin_label:] BEGIN [statement_list] END [end_label] BEGIN ... END 语法用于编写复合语句,复合语句可以出现在存储程序(存储过程和函数,触发器和事件)中。复合语句可以包含多个语句,并用BEGIN和 END关键字括起来。 stateme 阅读全文
posted @ 2020-08-18 07:16 wongchaofan 阅读(264) 评论(0) 推荐(0) 编辑
摘要:https://dev.mysql.com/doc/refman/5.7/en/sql-prepared-statements.html 阅读全文
posted @ 2020-08-18 06:51 wongchaofan 阅读(70) 评论(0) 推荐(0) 编辑
摘要:SET [GLOBAL | SESSION] TRANSACTION transaction_characteristic [, transaction_characteristic] ... transaction_characteristic: { ISOLATION LEVEL level | 阅读全文
posted @ 2020-08-18 06:43 wongchaofan 阅读(497) 评论(0) 推荐(0) 编辑
摘要:LOCK TABLES tbl_name [[AS] alias] lock_type [, tbl_name [[AS] alias] lock_type] ... lock_type: { READ [LOCAL] | [LOW_PRIORITY] WRITE } UNLOCK TABLES M 阅读全文
posted @ 2020-08-18 06:21 wongchaofan 阅读(279) 评论(0) 推荐(0) 编辑
摘要:SAVEPOINT identifier ROLLBACK [WORK] TO [SAVEPOINT] identifier RELEASE SAVEPOINT identifier InnoDB supports the SQL statements SAVEPOINT, ROLLBACK TO 阅读全文
posted @ 2020-08-18 02:24 wongchaofan 阅读(175) 评论(0) 推荐(0) 编辑
摘要:事务控制语句和锁语句也有例外:如果一个隐式提交发生在执行之前,那么其他的在之后也不会发生。 Data definition language (DDL) statements that define or modify database objects. ALTER DATABASE ... UPG 阅读全文
posted @ 2020-08-18 02:20 wongchaofan 阅读(241) 评论(0) 推荐(0) 编辑
摘要:https://dev.mysql.com/doc/refman/5.7/en/commit.html START TRANSACTION [transaction_characteristic [, transaction_characteristic] ...] transaction_char 阅读全文
posted @ 2020-08-18 01:57 wongchaofan 阅读(100) 评论(0) 推荐(0) 编辑
摘要:UPDATE is a DML statement that modifies rows in a table. Single-table syntax: UPDATE [LOW_PRIORITY] [IGNORE] table_reference SET assignment_list [WHER 阅读全文
posted @ 2020-08-18 01:17 wongchaofan 阅读(247) 评论(0) 推荐(0) 编辑
摘要:不建议使用子查询,能用链接的用链接,子查询影响服务器性能。 SELECT * FROM t1 WHERE column1 = (SELECT column1 FROM t2); DELETE FROM t1 WHERE s11 > ANY (SELECT COUNT(*) /* no hint */ 阅读全文
posted @ 2020-08-18 00:37 wongchaofan 阅读(71) 评论(0) 推荐(0) 编辑
摘要:SELECT [ALL | DISTINCT | DISTINCTROW ] [HIGH_PRIORITY] [STRAIGHT_JOIN] [SQL_SMALL_RESULT] [SQL_BIG_RESULT] [SQL_BUFFER_RESULT] [SQL_CACHE | SQL_NO_CAC 阅读全文
posted @ 2020-08-18 00:35 wongchaofan 阅读(259) 评论(0) 推荐(0) 编辑
摘要:REPLACE [LOW_PRIORITY | DELAYED] [INTO] tbl_name [PARTITION (partition_name [, partition_name] ...)] [(col_name [, col_name] ...)] {VALUES | VALUE} (v 阅读全文
posted @ 2020-08-18 00:18 wongchaofan 阅读(365) 评论(0) 推荐(0) 编辑
摘要:LOAD XML [LOW_PRIORITY | CONCURRENT] [LOCAL] INFILE 'file_name' [REPLACE | IGNORE] INTO TABLE [db_name.]tbl_name [CHARACTER SET charset_name] [ROWS ID 阅读全文
posted @ 2020-08-18 00:13 wongchaofan 阅读(313) 评论(0) 推荐(0) 编辑
摘要:LOAD DATA [LOW_PRIORITY | CONCURRENT] [LOCAL] INFILE 'file_name' [REPLACE | IGNORE] INTO TABLE tbl_name [PARTITION (partition_name [, partition_name] 阅读全文
posted @ 2020-08-18 00:10 wongchaofan 阅读(180) 评论(0) 推荐(0) 编辑
摘要:INSERT [LOW_PRIORITY | DELAYED | HIGH_PRIORITY] [IGNORE] [INTO] tbl_name [PARTITION (partition_name [, partition_name] ...)] [(col_name [, col_name] . 阅读全文
posted @ 2020-08-18 00:07 wongchaofan 阅读(1352) 评论(0) 推荐(0) 编辑
摘要:HANDLER tbl_name OPEN [ [AS] alias] HANDLER tbl_name READ index_name { = | <= | >= | < | > } (value1,value2,...) [ WHERE where_condition ] [LIMIT ... 阅读全文
posted @ 2020-08-17 07:01 wongchaofan 阅读(76) 评论(0) 推荐(0) 编辑
摘要:DO expr [, expr] ... DO语句执行表达式但不返回任何结果。 mysql> SELECT SLEEP(5); + + | SLEEP(5) | + + | 0 | + + 1 row in set (5.02 sec) mysql> DO SLEEP(5); Query OK, 0 阅读全文
posted @ 2020-08-17 06:39 wongchaofan 阅读(109) 评论(0) 推荐(0) 编辑
摘要:Single-Table Syntax DELETE [LOW_PRIORITY] [QUICK] [IGNORE] FROM tbl_name [PARTITION (partition_name [, partition_name] ...)] [WHERE where_condition] [ 阅读全文
posted @ 2020-08-17 06:36 wongchaofan 阅读(337) 评论(0) 推荐(0) 编辑
摘要:CALL sp_name([parameter[,...]]) CALL sp_name[()] CREATE PROCEDURE p (OUT ver_param VARCHAR(25), INOUT incr_param INT) BEGIN # Set value of OUT paramet 阅读全文
posted @ 2020-08-17 06:29 wongchaofan 阅读(548) 评论(0) 推荐(0) 编辑
摘要:RENAME TABLE RENAME TABLE tbl_name TO new_tbl_name [, tbl_name2 TO new_tbl_name2] ... RENAME TABLE old_table TO new_table; ALTER TABLE old_table RENAM 阅读全文
posted @ 2020-08-17 06:05 wongchaofan 阅读(85) 评论(0) 推荐(0) 编辑
摘要:CREATE TRIGGER CREATE [DEFINER = user] TRIGGER trigger_name trigger_time trigger_event ON tbl_name FOR EACH ROW [trigger_order] trigger_body trigger_t 阅读全文
posted @ 2020-08-17 06:00 wongchaofan 阅读(756) 评论(0) 推荐(0) 编辑
摘要:CREATE VIEW CREATE [OR REPLACE] [ALGORITHM = {UNDEFINED | MERGE | TEMPTABLE}] [DEFINER = user] [SQL SECURITY { DEFINER | INVOKER }] VIEW view_name [(c 阅读全文
posted @ 2020-08-17 05:57 wongchaofan 阅读(893) 评论(0) 推荐(0) 编辑
摘要:CREATE TABLESPACE CREATE TABLESPACE tablespace_name InnoDB and NDB: ADD DATAFILE 'file_name' InnoDB only: [FILE_BLOCK_SIZE = value] NDB only: USE LOGF 阅读全文
posted @ 2020-08-17 05:54 wongchaofan 阅读(265) 评论(0) 推荐(0) 编辑
摘要:CREATE LOGFILE GROUP CREATE LOGFILE GROUP logfile_group ADD UNDOFILE 'undo_file' [INITIAL_SIZE [=] initial_size] [UNDO_BUFFER_SIZE [=] undo_buffer_siz 阅读全文
posted @ 2020-08-17 05:51 wongchaofan 阅读(268) 评论(0) 推荐(0) 编辑
摘要:CREATE INDEX CREATE [UNIQUE | FULLTEXT | SPATIAL] INDEX index_name [index_type] ON tbl_name (key_part,...) [index_option] [algorithm_option | lock_opt 阅读全文
posted @ 2020-08-17 05:16 wongchaofan 阅读(801) 评论(0) 推荐(0) 编辑
摘要:CREATE PROCEDURE and CREATE FUNCTION CREATE [DEFINER = user] PROCEDURE sp_name ([proc_parameter[,...]]) [characteristic ...] routine_body CREATE [DEFI 阅读全文
posted @ 2020-08-17 05:13 wongchaofan 阅读(538) 评论(0) 推荐(0) 编辑
摘要:CREATE EVENT CREATE [DEFINER = user] EVENT [IF NOT EXISTS] event_name ON SCHEDULE schedule [ON COMPLETION [NOT] PRESERVE] [ENABLE | DISABLE | DISABLE 阅读全文
posted @ 2020-08-17 04:52 wongchaofan 阅读(240) 评论(0) 推荐(0) 编辑
摘要:CREATE TABLE CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name (create_definition,...) [table_options] [partition_options] CREATE [TEMPORARY] TABLE [I 阅读全文
posted @ 2020-08-17 04:50 wongchaofan 阅读(492) 评论(0) 推荐(0) 编辑
摘要:CREATE DATABASE CREATE {DATABASE | SCHEMA} [IF NOT EXISTS] db_name [create_option] ... create_option: { [DEFAULT] CHARACTER SET [=] charset_name | [DE 阅读全文
posted @ 2020-08-17 04:48 wongchaofan 阅读(285) 评论(0) 推荐(0) 编辑
摘要:PrivilegeGrant Table ColumnContext ALL [PRIVILEGES] Synonym for “all privileges” Server administration ALTER Alter_priv Tables ALTER ROUTINE Alter_rou 阅读全文
posted @ 2020-08-17 01:54 wongchaofan 阅读(81) 评论(0) 推荐(0) 编辑
摘要:1.1 PXC 简介 PXC 是一套 MySQL 高可用集群解决方案,与传统的基于主从复制模式的集群架构相比 PXC 最突出特点就是解决了诟病已久的数据复制延迟问题,基本上可以达到实时同步。而且节点与节点之间,他们相互的关系是对等的。PXC 最关注的是数据的一致性,对待事物的行为时,要么在所有节点上 阅读全文
posted @ 2020-08-17 01:33 wongchaofan 阅读(1187) 评论(0) 推荐(0) 编辑
摘要:(1)在创建业务表时,库名、表名、字段名必须使用小写字母,采用“_”分割。 (2)MYSQL数据库中,通过lower_case_table_names参数来区分表名的大小写,默认为0,代表大小写敏感。如果是1,代码大小写不敏感,以小写存储。为字段选取数据类型时,要秉承着简单、够用的原则。表中的字段和 阅读全文
posted @ 2020-08-17 00:05 wongchaofan 阅读(168) 评论(0) 推荐(0) 编辑
摘要:innodb_buffer_pool_size:如果是单实例且绝大多数是InnoDB引擎表,则可以设置为物理内存的50%~80%左右。 innodb_flush_log_at_trx_commit 和sync_binlog:分别是redo log刷新和binlog刷新的参数。如果要求数据不能丢失,建 阅读全文
posted @ 2020-08-16 16:58 wongchaofan 阅读(220) 评论(0) 推荐(0) 编辑
摘要:影响数据库最大的性能问题就是磁盘I/O,为了提升数据库的IOPS性能,可以使用SSD或者PCIE-SSD高速磁盘设备,至少可以获得上百倍或者上 万倍的IOPS性能提升。当数据库系统TPS过高或者业务量较高时,一定要配置阵列卡,而且阵列卡一直要配备cache模块,cache模块还要配置BBU模块来提供 阅读全文
posted @ 2020-08-16 16:04 wongchaofan 阅读(639) 评论(0) 推荐(0) 编辑
摘要:mysqldump 对于主从复制备份有几个重要的参数: -x, --lock-all-tables 锁住所有数据库的所有表,这是通过在整个转储期间使用全局读锁来实现的。会自动关闭选项--single-transaction和--lock-tables。 -l, --lock-tables Lock 阅读全文
posted @ 2020-08-13 03:26 wongchaofan 阅读(251) 评论(0) 推荐(0) 编辑
摘要:SSH主要用于远程登录。假定你要以用户名user,登录远程主机host,只要一条简单命令就可以了。 $ ssh user@host 如果在hosts文件中配置了别名,就可以直接使用别名登录了。 SSH之所以能够保证安全,原因在于它采用了公钥加密。 整个过程是这样的:(1)远程主机收到用户的登录请求, 阅读全文
posted @ 2020-08-13 00:25 wongchaofan 阅读(294) 评论(0) 推荐(0) 编辑

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