MySQL常用SQL语句之SHOW语句详解

SQL语句之SHOW语句

SHOW DATABASES – 显示当前所有数据库的名称

mysql> SHOW DATABASES;

SHOW TABLES – 显示当前数据库中所有表的名称(需要设置默认数据库use DATABASE_NAME)

Mysql> SHOW TABLES;

SHOW TABLES FROM db_name – 显示数据库中的所有表

Mysql> SHOW TABLES FROM db_name;

SHOW ENGINES - 显示MySQL当前支持哪些存储引擎和默认存储引擎

mysql> SHOW ENGINES;
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
| Engine             | Support | Comment                                                        | Transactions | XA   | Savepoints |
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
| MyISAM             | YES     | MyISAM storage engine                                          | NO           | NO   | NO         |
| CSV                | YES     | CSV storage engine                                             | NO           | NO   | NO         |
| MEMORY             | YES     | Hash based, stored in memory, useful for temporary tables      | NO           | NO   | NO         |
| BLACKHOLE          | YES     | /dev/null storage engine (anything you write to it disappears) | NO           | NO   | NO         |
| InnoDB             | DEFAULT | Supports transactions, row-level locking, and foreign keys     | YES          | YES  | YES        |
| MRG_MYISAM         | YES     | Collection of identical MyISAM tables                          | NO           | NO   | NO         |
| ARCHIVE            | YES     | Archive storage engine                                         | NO           | NO   | NO         |
| PERFORMANCE_SCHEMA | YES     | Performance Schema                                             | NO           | NO   | NO         |
| FEDERATED          | NO      | Federated MySQL storage engine                                 | NULL         | NULL | NULL       |
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
9 rows in set (0.00 sec)

SHOW CHARACTER SET – 显示MySQL当前支持哪些字符集

mysql> SHOW CHARACTER SET;
+----------+-----------------------------+---------------------+--------+
| Charset  | Description                 | Default collation   | Maxlen |
+----------+-----------------------------+---------------------+--------+
| big5     | Big5 Traditional Chinese    | big5_chinese_ci     |      2 |
| dec8     | DEC West European           | dec8_swedish_ci     |      1 |
-------------------------------------------------------------------------
mysql> SHOW CHARACTER SET LIKE ‘%utf%‘;
+---------+------------------+--------------------+--------+
| Charset | Description      | Default collation  | Maxlen |
+---------+------------------+--------------------+--------+
| utf8    | UTF-8 Unicode    | utf8_general_ci    |      3 |
| utf8mb4 | UTF-8 Unicode    | utf8mb4_general_ci |      4 |
| utf16   | UTF-16 Unicode   | utf16_general_ci   |      4 |
| utf16le | UTF-16LE Unicode | utf16le_general_ci |      4 |
| utf32   | UTF-32 Unicode   | utf32_general_ci   |      4 |
+---------+------------------+--------------------+--------+
5 rows in set (0.00 sec)

SHOW COLLATION – 显示MySQL支持字符集的排序规则

mysql> SHOW COLLATION;
+--------------------------+----------+-----+---------+----------+---------+
| Collation                | Charset  | Id  | Default | Compiled | Sortlen |
+--------------------------+----------+-----+---------+----------+---------+
| big5_chinese_ci          | big5     |   1 | Yes     | Yes      |       1 |
| big5_bin                 | big5     |  84 |         | Yes      |       1 |

SHOW BINARY | MASTER – 显示二进制文件以及文件大小(需要开启二进制日志记录功能)

mysql> SHOW BINARY LOGS;
mysql> SHOW MASTER LOGS;
+------------------+-----------+
| Log_name         | File_size |
+------------------+-----------+
| mysql-bin.000001 |       143 |
| mysql-bin.000002 |       143 |

SHOW BINLOG EVENTS – 显示二进制文件的执行过程

mysql> SHOW BINLOG EVENTS IN ‘mysql-bin.000001‘;
+------------------+-----+-------------+-----------+-------------+---------------------------------------+
| Log_name         | Pos | Event_type  | Server_id | End_log_pos | Info                                  |
+------------------+-----+-------------+-----------+-------------+---------------------------------------+
| mysql-bin.000001 |   4 | Format_desc |         1 |         120 | Server ver: 5.6.27-log, Binlog ver: 4 |
| mysql-bin.000001 | 120 | Stop        |         1 |         143 |                                       |
+------------------+-----+-------------+-----------+-------------+---------------------------------------+
2 rows in set (0.00 sec)
mysql> SHOW BINLOG EVENTS IN ‘mysql-bin.000001‘ FROM 120;
+------------------+-----+------------+-----------+-------------+------+
| Log_name         | Pos | Event_type | Server_id | End_log_pos | Info |
+------------------+-----+------------+-----------+-------------+------+
| mysql-bin.000001 | 120 | Stop       |         1 |         143 |      |
+------------------+-----+------------+-----------+-------------+------+
1 row in set (0.01 sec)

SHOW COLUMNS – 显示表的列信息(等同于DESC,需要先创建表)

mysql> SHOW COLUMNS FROM blog.info;
+---------+---------------+------+-----+---------+----------------+
| Field   | Type          | Null | Key | Default | Extra          |
+---------+---------------+------+-----+---------+----------------+
| ID      | int(11)       | NO   | PRI | NULL    | auto_increment |
| NAME    | char(8)       | NO   |     | NULL    |                |
| AGE     | int(11)       | NO   |     | NULL    |                |
| ADDRESS | varchar(20)   | NO   |     | NULL    |                |
| SALARY  | decimal(10,2) | NO   |     | NULL    |                |
+---------+---------------+------+-----+---------+----------------+
5 rows in set (0.06 sec)

SHOW CREATE DATABASES – 显示已经创建的库,创建时的语句

mysql> SHOW CREATE DATABASE blog;
+----------+-----------------------------------------------------------------+
| Database | Create Database                                                 |
+----------+-----------------------------------------------------------------+
| testdb   | CREATE DATABASE `testdb` /*!40100 DEFAULT CHARACTER SET utf8 */ |
+----------+-----------------------------------------------------------------+
1 row in set (0.00 sec)

SHOW CREATE TABLE – 显示已经创建的表,创建时的语句

mysql> SHOW CREATE TABLE info\G
*************************** 1. row ***************************
       Table: info
Create Table: CREATE TABLE `info` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `NAME` char(8) NOT NULL,
  `AGE` int(11) NOT NULL,
  `ADDRESS` varchar(20) NOT NULL,
  `SALARY` decimal(10,2) NOT NULL,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8
1 row in set (0.00 sec)

SHOW CREATE FUNTCION  – 显示已经创建的函数,创建时的语句

SHOW CREATE PROCEDURE – 显示已经创建的存储过程,创建时的语句

mysql> SHOW CREATE PROCEDURE test.simpleproc\G
*************************** 1. row ***************************
           Procedure: simpleproc - 存储过程的名字
            sql_mode:
    Create Procedure: CREATE PROCEDURE `simpleproc`(OUT param1 INT)
                      BEGIN
                      SELECT COUNT(*) INTO param1 FROM t;
                      END
character_set_client: latin1
collation_connection: latin1_swedish_ci
  Database Collation: latin1_swedish_ci

SHOW CREATE TRIGGER - 显示已经创建的触发器,创建时的语句

mysql> SHOW CREATE TRIGGER ins_sum\G
*************************** 1. row ***************************
               Trigger: ins_sum
              sql_mode: NO_ENGINE_SUBSTITUTION
SQL Original Statement: CREATE DEFINER=`me`@`localhost` TRIGGER ins_sum
                        BEFORE INSERT ON account
                        FOR EACH ROW SET @sum = @sum + NEW.amount
  character_set_client: utf8
  collation_connection: utf8_general_ci
    Database Collation: latin1_swedish_ci

SHOW CREATE VIEW – 显示已经创建的视图,创建时的语句

mysql> SHOW CREATE VIEW v\G
*************************** 1. row ***************************
                View: v
         Create View: CREATE ALGORITHM=UNDEFINED
                      DEFINER=`bob`@`localhost`
                      SQL SECURITY DEFINER VIEW
                      `v` AS select 1 AS `a`,2 AS `b`
character_set_client: latin1
collation_connection: latin1_swedish_ci

SHOW CREATE EVENTS – 显示已经创建的事件,创建时的语句

mysql> SHOW CREATE EVENT test.e_daily\G
*************************** 1. row ***************************
               Event: e_daily
            sql_mode:
           time_zone: SYSTEM
        Create Event: CREATE EVENT `e_daily`
                        ON SCHEDULE EVERY 1 DAY
                        STARTS CURRENT_TIMESTAMP + INTERVAL 6 HOUR
                        ON COMPLETION NOT PRESERVE
                        ENABLE
                        COMMENT ‘Saves total number of sessions then
                                clears the table each day‘
                        DO BEGIN
                          INSERT INTO site_activity.totals (time, total)
                            SELECT CURRENT_TIMESTAMP, COUNT(*)
                            FROM site_activity.sessions;
                          DELETE FROM site_activity.sessions;
                        END
character_set_client: latin1
collation_connection: latin1_swedish_ci
  Database Collation: latin1_swedish_ci

SHOW ENGINE – 显示存储引擎的详细信息

mysql> SHOW ENGINE INNODB STATUS\G
*************************** 1. row ***************************
  Type: InnoDB
  Name:
Status:
=====================================
2015-11-22 19:05:05 7f6b6c780700 INNODB MONITOR OUTPUT
=====================================
Per second averages calculated from the last 61 seconds
..................

SHOW WARNINGS – 显示最后一个执行语句所产生的警告信息

mysql> SHOW WARNINGS\G
mysql> SELECT @@warning_count;
+-----------------+
| @@warning_count |
+-----------------+
|               1 |
+-----------------+
1 row in set (0.01 sec)

SHOW ERRORS – 显示最后一个执行语句所产生的错误信息

mysql> SHOW ERRORS\G

SHOW EVENTS – 显示事件信息

mysql> SHOW EVENTS;
Empty set (0.02 sec)

SHOW GRANTS – 显示一个用户所拥有的权限

mysql> SHOW GRANTS;
mysql> SHOW GRANTS FOR CURRENT_USER();
mysql> SHOW GRANTS FOR ‘root‘@‘localhost‘;
+---------------------------------------------------------------------+
| Grants for [email protected]                                           |
+---------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘localhost‘ WITH GRANT OPTION |
+---------------------------------------------------------------------+

SHOW PROCESSLIST – 显示系统中正在运行的所有进程,普通用户只能查看自己的进行信息

mysql> SHOW PROCESSLIST;
+----+------+-----------+------+---------+------+-------+------------------+
| Id | User | Host      | db   | Command | Time | State | Info             |
+----+------+-----------+------+---------+------+-------+------------------+
|  6 | root | localhost | blog | Query   |    0 | init  | SHOW PROCESSLIST |
+----+------+-----------+------+---------+------+-------+------------------+
1 row in set (0.00 sec)

SHOW PRIVILEGES – 显示MySQL所支持的所有权限,及权限可操作的对象

mysql> SHOW PRIVILEGES;
+-------------------------+---------------------------------------+-------------------------------------------------------+
| Privilege               | Context                               | Comment                                               |
+-------------------------+---------------------------------------+-------------------------------------------------------+
| Alter                   | Tables                                | To alter the table                                    |
| Alter routine           | Functions,Procedures                  | To alter or drop stored functions/procedures          |

SHOW PLUGINS – 显示MySQL插件信息

mysql> SHOW PLUGINS;
+----------------------------+----------+--------------------+---------+---------+
| Name                       | Status   | Type               | Library | License |
+----------------------------+----------+--------------------+---------+---------+
| binlog                     | ACTIVE   | STORAGE ENGINE     | NULL    | GPL     |
| mysql_native_password      | ACTIVE   | AUTHENTICATION     | NULL    | GPL     |
| mysql_old_password         | ACTIVE   | AUTHENTICATION     | NULL    | GPL     |
| sha256_password            | ACTIVE   | AUTHENTICATION     | NULL    | GPL     |
| MRG_MYISAM                 | ACTIVE   | STORAGE ENGINE     | NULL    | GPL     |
| CSV                        | ACTIVE   | STORAGE ENGINE     | NULL    | GPL     |
| MyISAM                     | ACTIVE   | STORAGE ENGINE     | NULL    | GPL     |
| MEMORY                     | ACTIVE   | STORAGE ENGINE     | NULL    | GPL     |
| InnoDB                     | ACTIVE   | STORAGE ENGINE     | NULL    | GPL     |
...................

SHOW MASTER STATUS – 显示Master当前正在使用的二进制信息

mysql> SHOW MASTER STATUS;
+------------------+----------+--------------+------------------+-------------------+
| File             | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+------------------+----------+--------------+------------------+-------------------+
| mysql-bin.000010 |     7040 |              |                  |                   |
+------------------+----------+--------------+------------------+-------------------+
1 row in set (0.00 sec)

SHOW TABLE STATUS – 显示表属性信息

mysql> SHOW TABLE STATUS LIKE ‘info‘\G
*************************** 1. row ***************************
           Name: info - 表名
         Engine: InnoDB - 表存储引擎
        Version: 10 - 表文件版本号
     Row_format: Compact - 行存储格式(固定、动态、压缩、冗余、紧凑)
           Rows: 1 - 表中行数量
 Avg_row_length: 16384 - 平均行长度
    Data_length: 16384 - 数据文件长度
Max_data_length: 0 - 数据文件最大长度,这是可以存储在表中的数据的总字节数
   Index_length: 0 - 索引文件长度
      Data_free: 0 - 表文件已分配但未使用的字节数
 Auto_increment: 2 - 下一个auto_increment的值
    Create_time: 2015-11-22 17:53:10 - 表创建时间
    Update_time: NULL - 表更新时间,没有为NULL
     Check_time: NULL - 表检查时间,没有为NULL
      Collation: utf8_general_ci - 表使用的排序规则
       Checksum: NULL - 表校验
 Create_options:
        Comment:
1 row in set (0.00 sec)

SHOW INDEX – 显示表索引信息(需要先创建索引,详情看“索引文章”)

mysql> show index from testdb.info\G
*************************** 1. row ***************************
        Table: info - 表名
   Non_unique: 0
     Key_name: PRIMARY - 索引名字
 Seq_in_index: 1 - 索引中列顺序号从1开始
  Column_name: ID - 索引列
    Collation: A - 列怎样在索引中被排序
  Cardinality: 6 - 索引中唯一值的数量
     Sub_part: NULL
       Packed: NULL
         Null:
   Index_type: BTREE - 索引算法类型
      Comment:
Index_comment:
1 row in set (0.01 sec)

SHOW PROCEDURE STATUS – 显示存储过程信息(需要先创建存储过程,详情请看“存储过程文章”)

mysql> SHOW PROCEDURE STATUS LIKE ‘sp1‘\G
*************************** 1. row ***************************
                  Db: test
                Name: sp1
                Type: PROCEDURE
             Definer: [email protected]
            Modified: 2004-08-03 15:29:37
             Created: 2004-08-03 15:29:37
       Security_type: DEFINER
             Comment:
character_set_client: latin1
collation_connection: latin1_swedish_ci
  Database Collation: latin1_swedish_ci

SHOW FUNCTION STATUS – 显示存储函数信息(需要先创建存储函数,详情看“存储函数文章”)

mysql> SHOW fUNCTION STATUS;
Empty set (0.00 sec)

SHOW TRIGGERS – 显示触发器信息(需要先创建触发器,详情看“触发器部分”)

mysql> SHOW TRIGGERS LIKE ‘acc%‘\G
*************************** 1. row ***************************
             Trigger: ins_sum - 触发器名字
               Event: INSERT - 触发事件
               Table: account - 在那个表定义触发器
           Statement: SET @sum = @sum + NEW.amount - 触发体
              Timing: BEFORE - 是在触发之前激活触发事件,还是在触发之后激活触发事件
             Created: NULL -
            sql_mode: NO_ENGINE_SUBSTITUTION - 触发器执行时的SQL模式
             Definer: [email protected] - 谁创建了触发器
character_set_client: utf8
collation_connection: utf8_general_ci
  Database Collation: latin1_swedish_ci

SHOW PROFILE and SHOW PROFILES – 显示执行语句的资源使用情况

mysql> SELECT @@profiling;
+-------------+
| @@profiling |
+-------------+
|           0 |
+-------------+
1 row in set, 1 warning (0.00 sec)
mysql> SET profiling = 1;
mysql> CREATE TABLE T1 (id INT);
mysql> SHOW PROFILES;
+----------+------------+--------------------------+
| Query_ID | Duration   | Query                    |
+----------+------------+--------------------------+
|        1 | 0.11698325 | CREATE TABLE T1 (id INT) |
|        2 | 0.12255200 | CREATE TABLE T2 (id INT) |
+----------+------------+--------------------------+
2 rows in set, 1 warning (0.00 sec)
mysql> SHOW PROFILE;
+----------------------+----------+
| Status               | Duration |
+----------------------+----------+
| starting             | 0.000080 |
| checking permissions | 0.000015 |
| Opening tables       | 0.000129 |
| creating table       | 0.106344 |
| After create         | 0.000033 |
| query end            | 0.000066 |
| closing tables       | 0.000017 |
| freeing items        | 0.000241 |
| cleaning up          | 0.015628 |
+----------------------+----------+
9 rows in set, 1 warning (0.00 sec)
mysql> SHOW PROFILE FOR QUERY 2;
+----------------------+----------+
| Status               | Duration |
+----------------------+----------+
| starting             | 0.000080 |
-----------------------------------
mysql> SHOW PROFILE CPU FOR QUERY 2;
+----------------------+----------+----------+------------+
| Status               | Duration | CPU_user | CPU_system |
+----------------------+----------+----------+------------+
| starting             | 0.000080 | 0.000000 |   0.000000 |
----------------------------------------------------------
TYPE: CPU | MEMORY | IPC | SOURCE | ALL | BLOCK IO | SWAPS

SHOW SLAVE HOSTS – 显示Master主机上已注册的复制主机列表(需要先做主从复制,详情看“主从复制部分”)

mysql> SHOW SLAVE HOSTS;
+-----------+-----------+-------+-----------+--------------------------------------+
| Server_id | Host      | Port  | Master_id | Slave_UUID                           |
+-----------+-----------+-------+-----------+--------------------------------------+
|  192168010 | iconnect2 | 3306 | 192168011 | 14cb6624-7f93-11e0-b2c0-c80aa9429562 |
| 1921680101 | athena    | 3306 | 192168011 | 07af4990-f41f-11df-a566-7ac56fdaf645 |
+------------+-----------+------+-----------+--------------------------------------+

SHOW SLAVE STATUS – 显示Slave主机状态信息(需要先做主从复制,详情看“主从复制部分”)

mysql> SHOW SLAVE STATUS\G
*************************** 1. row ***************************
               Slave_IO_State: Waiting for master to send event
                  Master_Host: localhost
                  Master_User: root
                  Master_Port: 13000
                Connect_Retry: 60
              Master_Log_File: master-bin.000002
          Read_Master_Log_Pos: 1307
               Relay_Log_File: slave-relay-bin.000003
                Relay_Log_Pos: 1508
        Relay_Master_Log_File: master-bin.000002
             Slave_IO_Running: Yes
            Slave_SQL_Running: Yes
              Replicate_Do_DB:
          Replicate_Ignore_DB:
...........

SHOW GLOBAL | SESSION STATUS – 显示MySQL状态变量信息

mysql> SHOW GLOBAL STATUS;
+-----------------------------------------------+--------------------------------------------------+
| Variable_name                                 | Value                                            |
+-----------------------------------------------+--------------------------------------------------+
| Aborted_clients                               | 3                                                |
| Aborted_connects                              | 1                                                |
| Binlog_cache_disk_use                         | 0                                                |
| Binlog_cache_use                              | 25                                               |
................

SHOW GLOBAL | SESSION VARIABLES – 显示MySQL系统变量信息

mysql> SHOW SESSION VARIABLES LIKE ‘%INNODB%‘;
+------------------------------------------+------------------------+
| Variable_name                            | Value                  |
+------------------------------------------+------------------------+
| ignore_builtin_innodb                    | OFF                    |
| innodb_adaptive_flushing                 | ON                     |
| innodb_adaptive_flushing_lwm             | 10                     |
| innodb_adaptive_hash_index               | ON                     |
| innodb_adaptive_max_sleep_delay          | 150000                 |
| innodb_additional_mem_pool_size          | 8388608                |
| innodb_api_bk_commit_interval            | 5                      |
| innodb_api_disable_rowlock               | OFF                    |
| innodb_api_enable_binlog                 | OFF                    |
| innodb_api_enable_mdl                    | OFF                    |
| innodb_api_trx_level                     | 0                      |
| innodb_autoextend_increment              | 64                     |
| innodb_autoinc_lock_mode                 | 1                      |
| innodb_buffer_pool_dump_at_shutdown      | ON                     |
| innodb_buffer_pool_dump_now              | OFF                    |
| innodb_buffer_pool_filename              | ib_buffer_pool         |
..........................

GOOD LUCK!

参考博客 http://www.ywnds.com/?p=2929

原文地址:https://www.cnblogs.com/wchonge/p/8462814.html

时间: 2024-10-15 22:22:24

MySQL常用SQL语句之SHOW语句详解的相关文章

常用经典SQL语句大全完整版--详解+实例 《来自网络,很全没整理,寄存与此》

常用经典SQL语句大全完整版--详解+实例 下列语句部分是Mssql语句,不可以在access中使用. SQL分类: DDL—数据定义语言(CREATE,ALTER,DROP,DECLARE) DML—数据操纵语言(SELECT,DELETE,UPDATE,INSERT) DCL—数据控制语言(GRANT,REVOKE,COMMIT,ROLLBACK) 首先,简要介绍基础语句: 1.说明:创建数据库CREATE DATABASE database-name 2.说明:删除数据库drop data

MySQL常用SQL语句(Python实现学生、课程、选课表增删改查)

以基本的学生选课为例,建立选课数据库,学生.班级.选课信息三张表,并分别对表进行插删改操作: import MySQLdb try: conn = MySQLdb.connect(host = 'localhost', user = 'root', passwd = 'root', db = 'xuanke', port = 3306) cur = conn.cursor() cur.execute("CREATE DATABASE xuanke") cur.execute("

Mysql常用sql语句(一)- 操作数据库

21篇测试必备的Mysql常用sql语句,每天敲一篇,每次敲三遍,每月一循环,全都可记住!! https://www.cnblogs.com/poloyy/category/1683347.html 需要注意,创建数据库和创建表的语句博文都在前面哦,整个系列都是相互关联的哈,需要用到前面创建的数据库和表哦 前言 针对数据库的操作语句叫做数据定义语言(DDL)   数据库有哪些操作呢? 创建数据库 查询数据库 修改数据库 删除数据库 选择数据库 简称“增删改查“,点击右边目录即可跳转哦! ----

Mysql常用sql语句(二)- 操作数据表

21篇测试必备的Mysql常用sql语句,每天敲一篇,每次敲三遍,每月一循环,全都可记住!! https://www.cnblogs.com/poloyy/category/1683347.html 需要注意,创建数据库和创建表的语句博文都在前面哦 整个系列都是相互关联的哈,需要用到前面创建的数据库和表哦(系列博文第一篇和第二篇) 前言 针对数据表的操作语句叫做数据定义语言(DDL)   数据表有哪些操作? 创建数据表 查看表结构 查看数据表的创建语句 复制数据表 修改数据表 删除数据表 简称“

Oracle创建表语句(Create table)语法详解及示例

Oracle创建表语句(Create table)语法详解及示例   创建表(Create table)语法详解1. ORACLE常用的字段类型ORACLE常用的字段类型有VARCHAR2 (size) 可变长度的字符串, 必须规定长度CHAR(size) 固定长度的字符串, 不规定长度默认值为1NUMBER(p,s) 数字型p是位数总长度, s是小数的长度, 可存负数最长38位. 不够位时会四舍五入.DATE 日期和时间类型LOB 超长字符, 最大可达4GCLOB 超长文本字符串BLOB 超长

Mysql Join语法解析与性能分析详解

一.Join语法概述 join 用于多表中字段之间的联系,语法如下: ... FROM table1 INNER|LEFT|RIGHT JOIN table2 ON conditiona table1:左表:table2:右表. JOIN 按照功能大致分为如下三类: INNER JOIN(内连接,或等值连接):取得两个表中存在连接匹配关系的记录. LEFT JOIN(左连接):取得左表(table1)完全记录,即是右表(table2)并无对应匹配记录. RIGHT JOIN(右连接):与 LEF

Linq实战 之 Linq to Sql及Entity Framework操作详解

Linq实战 之 Linq to Sql及Entity Framework操作详解 一:linq to db的框架 1. linq to sql 2. linq to ado.net entity framework linq to sql是一个团队 ef 是一个团队... linq to sql => ef 团队. linq to sql 适合一些小型的项目 => sqlserver ef 适合中形的项目,而且可以支持 sqllite,mysql,sqlserver 掌柜的项目开发中:使用的

mysql服务性能优化—my.cnf配置说明详解

MYSQL服务器my.cnf配置文档详解硬件:内存16G [client]port = 3306socket = /data/3306/mysql.sock [mysql]no-auto-rehash [mysqld]user = mysqlport = 3306socket = /data/3306/mysql.sockbasedir = /usr/local/mysqldatadir = /data/3306/dataopen_files_limit = 10240 back_log = 6

MySQL慢查询(二) - pt-query-digest详解慢查询日志 pt-query-digest 慢日志分析

随笔 - 66 文章 - 0 评论 - 19 MySQL慢查询(二) - pt-query-digest详解慢查询日志 一.简介 pt-query-digest是用于分析mysql慢查询的一个工具,它可以分析binlog.General log.slowlog,也可以通过SHOWPROCESSLIST或者通过tcpdump抓取的MySQL协议数据来进行分析.可以把分析结果输出到文件中,分析过程是先对查询语句的条件进行参数化,然后对参数化以后的查询进行分组统计,统计出各查询的执行时间.次数.占比等

Mysql高手系列 - 第14篇:详解事务

这是Mysql系列第14篇. 环境:mysql5.7.25,cmd命令中进行演示. 开发过程中,会经常用到数据库事务,所以本章非常重要. 本篇内容 什么是事务,它有什么用? 事务的几个特性 事务常见操作指令详解 事务的隔离级别详解 脏读.不可重复读.可重复读.幻读详解 演示各种隔离级别产生的现象 关于隔离级别的选择 什么是事务? 数据库中的事务是指对数据库执行一批操作,这些操作最终要么全部执行成功,要么全部失败,不会存在部分成功的情况. 举个例子 比如A用户给B用户转账100操作,过程如下: 1