Showing posts with label maria. Show all posts
Showing posts with label maria. Show all posts

Sunday, 8 July 2018

[MySQL/MariaDB] About Timeout

There are 3 kinds of timeout in MySQL or MariaDB and you can change timeout modifying 'my.cnf' or executing queries.

1. CONNECT_TIMEOUT

For bad handshake timeout. When MySQL client try to connect to mysqld(daemon), CONNECT_TIMEOUT is maximum time to wait connect packet for mysqld.

About errors.
1) Aborted_connects : FAILED TO CONNECT. When connecting to server, it is failed to connect.
2) Aborted_clients : CANCEL CONNECTION FORCIBLY. When connected to server, server close connection forcibly.


2. INTERACTIVE_TIMEOUT

This is timeout in interactive mode. The interactive mode means console mode in prompt or terminal mode.
It is maximum time that wait to receive request(Query) from client.

About Errors
ERROR 2006: MySQL server has gone away  No connection. Trying to reconnect...  Connection id:    12002  Current database: xxx


3. WAIT_TIMEOUT

This is timeout in not interactive mode likes in applications for database. It is maximum time that wait to receive request(Query) from client.














✑ References : http://www.mysqlkorea.com/gnuboard4/bbs/board.php?bo_table=community_04&wr_id=705

[MySQL/MariaDB] Plugin 'unix_socket' is not loaded

When use mysql -u root -p command, I met "Plugin ‘unix_socket’ is not loaded" message. This issue relates to Unix authentication plugin.





Solution

1. Edit 50-server.cnf file




2. Add option




3. Restart MariaDB







Wednesday, 4 January 2017

[Maria/MySQL] DB Backup using mysqldump command (mysqldump 명령어를 이용한 DB 백업)

#> mysqldump -u[USER] -p[PASSWORD] [DB_NAME] > [BACKUP_FILE_NAME]











Dumping structure and contents of MySQL databases and tables.
Usage: mysqldump [OPTIONS] database [tables]
OR     mysqldump [OPTIONS] --databases [OPTIONS] DB1 [DB2 DB3...]
OR     mysqldump [OPTIONS] --all-databases [OPTIONS]

Default options are read from the following files in the given order:
/etc/mysql/my.cnf /etc/my.cnf ~/.my.cnf
The following groups are read: mysqldump client client-server client-mariadb
The following options may be given as the first argument:
--print-defaults        Print the program argument list and exit.
--no-defaults           Don't read default options from any option file.
--defaults-file=#       Only read default options from the given file #.
--defaults-extra-file=# Read this file after the global files are read.

  -A, --all-databases Dump all the databases. This will be same as --databases
                      with all databases selected.
  -Y, --all-tablespaces
                      Dump all the tablespaces.
  -y, --no-tablespaces
                      Do not dump any tablespace information.
  --add-drop-database Add a DROP DATABASE before each create.
  --add-drop-table    Add a DROP TABLE before each create.
                      (Defaults to on; use --skip-add-drop-table to disable.)
  --add-locks         Add locks around INSERT statements.
                      (Defaults to on; use --skip-add-locks to disable.)
  --allow-keywords    Allow creation of column names that are keywords.
  --apply-slave-statements
                      Adds 'STOP SLAVE' prior to 'CHANGE MASTER' and 'START
                      SLAVE' to bottom of dump.
  --character-sets-dir=name
                      Directory for character set files.
  -i, --comments      Write additional information.
                      (Defaults to on; use --skip-comments to disable.)
  --compatible=name   Change the dump to be compatible with a given mode. By
                      default tables are dumped in a format optimized for
                      MySQL. Legal modes are: ansi, mysql323, mysql40,
                      postgresql, oracle, mssql, db2, maxdb, no_key_options,
                      no_table_options, no_field_options. One can use several
                      modes separated by commas. Note: Requires MySQL server
                      version 4.1.0 or higher. This option is ignored with
                      earlier server versions.
  --compact           Give less verbose output (useful for debugging). Disables
                      structure comments and header/footer constructs.  Enables
                      options --skip-add-drop-table --skip-add-locks
                      --skip-comments --skip-disable-keys --skip-set-charset.
  -c, --complete-insert
                      Use complete insert statements.
  -C, --compress      Use compression in server/client protocol.
  -a, --create-options
                      Include all MySQL specific create options.
                      (Defaults to on; use --skip-create-options to disable.)
  -B, --databases     Dump several databases. Note the difference in usage; in
                      this case no tables are given. All name arguments are
                      regarded as database names. 'USE db_name;' will be
                      included in the output.
  -#, --debug[=#]     This is a non-debug version. Catch this and exit.
  --debug-check       Check memory and open file usage at exit.
  --debug-info        Print some debug info at exit.
  --default-character-set=name
                      Set the default character set.
  --delayed-insert    Insert rows with INSERT DELAYED.
  --delete-master-logs
                      Delete logs on master after backup. This automatically
                      enables --master-data.
  -K, --disable-keys  '/*!40000 ALTER TABLE tb_name DISABLE KEYS */; and
                      '/*!40000 ALTER TABLE tb_name ENABLE KEYS */; will be put
                      in the output.
                      (Defaults to on; use --skip-disable-keys to disable.)
  --dump-slave[=#]    This causes the binary log position and filename of the
                      master to be appended to the dumped data output. Setting
                      the value to 1, will printit as a CHANGE MASTER command
                      in the dumped data output; if equal to 2, that command
                      will be prefixed with a comment symbol. This option will
                      turn --lock-all-tables on, unless --single-transaction is
                      specified too (in which case a global read lock is only
                      taken a short time at the beginning of the dump - don't
                      forget to read about --single-transaction below). In all
                      cases any action on logs will happen at the exact moment
                      of the dump.Option automatically turns --lock-tables off.
  -E, --events        Dump events.
  -e, --extended-insert
                      Use multiple-row INSERT syntax that include several
                      VALUES lists.
                      (Defaults to on; use --skip-extended-insert to disable.)
  --fields-terminated-by=name
                      Fields in the output file are terminated by the given
                      string.
  --fields-enclosed-by=name
                      Fields in the output file are enclosed by the given
                      character.
  --fields-optionally-enclosed-by=name
                      Fields in the output file are optionally enclosed by the
                      given character.
  --fields-escaped-by=name
                      Fields in the output file are escaped by the given
                      character.
  -F, --flush-logs    Flush logs file in server before starting dump. Note that
                      if you dump many databases at once (using the option
                      --databases= or --all-databases), the logs will be
                      flushed for each database dumped. The exception is when
                      using --lock-all-tables or --master-data: in this case
                      the logs will be flushed only once, corresponding to the
                      moment all tables are locked. So if you want your dump
                      and the log flush to happen at the same exact moment you
                      should use --lock-all-tables or --master-data with
                      --flush-logs.
  --flush-privileges  Emit a FLUSH PRIVILEGES statement after dumping the mysql
                      database.  This option should be used any time the dump
                      contains the mysql database and any other database that
                      depends on the data in the mysql database for proper
                      restore.
  -f, --force         Continue even if we get an SQL error.
  -?, --help          Display this help message and exit.
  --hex-blob          Dump binary strings (BINARY, VARBINARY, BLOB) in
                      hexadecimal format.
  -h, --host=name     Connect to host.
  --ignore-table=name Do not dump the specified table. To specify more than one
                      table to ignore, use the directive multiple times, once
                      for each table.  Each table must be specified with both
                      database and table names, e.g.,
                      --ignore-table=database.table.
  --include-master-host-port
                      Adds 'MASTER_HOST=<host>, MASTER_PORT=<port>' to 'CHANGE
                      MASTER TO..' in dump produced with --dump-slave.
  --insert-ignore     Insert rows with INSERT IGNORE.
  --lines-terminated-by=name
                      Lines in the output file are terminated by the given
                      string.
  -x, --lock-all-tables
                      Locks all tables across all databases. This is achieved
                      by taking a global read lock for the duration of the
                      whole dump. Automatically turns --single-transaction and
                      --lock-tables off.
  -l, --lock-tables   Lock all tables for read.
                      (Defaults to on; use --skip-lock-tables to disable.)
  --log-error=name    Append warnings and errors to given file.
  --master-data[=#]   This causes the binary log position and filename to be
                      appended to the output. If equal to 1, will print it as a
                      CHANGE MASTER command; if equal to 2, that command will
                      be prefixed with a comment symbol. This option will turn
                      --lock-all-tables on, unless --single-transaction is
                      specified too (on servers before MariaDB 5.3 this will
                      still take a global read lock for a short time at the
                      beginning of the dump; don't forget to read about
                      --single-transaction below). In all cases, any action on
                      logs will happen at the exact moment of the dump. Option
                      automatically turns --lock-tables off.
  --max-allowed-packet=#
                      The maximum packet length to send to or receive from
                      server.
  --net-buffer-length=#
                      The buffer size for TCP/IP and socket communication.
  --no-autocommit     Wrap tables with autocommit/commit statements.
  -n, --no-create-db  Suppress the CREATE DATABASE ... IF EXISTS statement that
                      normally is output for each dumped database if
                      --all-databases or --databases is given.
  -t, --no-create-info
                      Don't write table creation info.
  -d, --no-data       No row information.
  -N, --no-set-names  Same as --skip-set-charset.
  --opt               Same as --add-drop-table, --add-locks, --create-options,
                      --quick, --extended-insert, --lock-tables, --set-charset,
                      and --disable-keys. Enabled by default, disable with
                      --skip-opt.
  --order-by-primary  Sorts each table's rows by primary key, or first unique
                      key, if such a key exists.  Useful when dumping a MyISAM
                      table to be loaded into an InnoDB table, but will make
                      the dump itself take considerably longer.
  -p, --password[=name]
                      Password to use when connecting to server. If password is
                      not given it's solicited on the tty.
  -P, --port=#        Port number to use for connection.
  --protocol=name     The protocol to use for connection (tcp, socket, pipe,
                      memory).
  -q, --quick         Don't buffer query, dump directly to stdout.
                      (Defaults to on; use --skip-quick to disable.)
  -Q, --quote-names   Quote table and column names with backticks (`).
                      (Defaults to on; use --skip-quote-names to disable.)
  --replace           Use REPLACE INTO instead of INSERT INTO.
  -r, --result-file=name
                      Direct output to a given file. This option should be used
                      in systems (e.g., DOS, Windows) that use carriage-return
                      linefeed pairs (\r\n) to separate text lines. This option
                      ensures that only a single newline is used.
  -R, --routines      Dump stored routines (functions and procedures).
  --set-charset       Add 'SET NAMES default_character_set' to the output.
                      (Defaults to on; use --skip-set-charset to disable.)
  --single-transaction
                      Creates a consistent snapshot by dumping all tables in a
                      single transaction. Works ONLY for tables stored in
                      storage engines which support multiversioning (currently
                      only InnoDB does); the dump is NOT guaranteed to be
                      consistent for other storage engines. While a
                      --single-transaction dump is in process, to ensure a
                      valid dump file (correct table contents and binary log
                      position), no other connection should use the following
                      statements: ALTER TABLE, DROP TABLE, RENAME TABLE,
                      TRUNCATE TABLE, as consistent snapshot is not isolated
                      from them. Option automatically turns off --lock-tables.
  --dump-date         Put a dump date to the end of the output.
                      (Defaults to on; use --skip-dump-date to disable.)
  --skip-opt          Disable --opt. Disables --add-drop-table, --add-locks,
                      --create-options, --quick, --extended-insert,
                      --lock-tables, --set-charset, and --disable-keys.
  -S, --socket=name   The socket file to use for connection.
  --ssl               Enable SSL for connection (automatically enabled with
                      other flags).
  --ssl-ca=name       CA file in PEM format (check OpenSSL docs, implies
                      --ssl).
  --ssl-capath=name   CA directory (check OpenSSL docs, implies --ssl).
  --ssl-cert=name     X509 cert in PEM format (implies --ssl).
  --ssl-cipher=name   SSL cipher to use (implies --ssl).
  --ssl-key=name      X509 key in PEM format (implies --ssl).
  --ssl-verify-server-cert
                      Verify server's "Common Name" in its cert against
                      hostname used when connecting. This option is disabled by
                      default.
  -T, --tab=name      Create tab-separated textfile for each table to given
                      path. (Create .sql and .txt files.) NOTE: This only works
                      if mysqldump is run on the same machine as the mysqld
                      server.
  --tables            Overrides option --databases (-B).
  --triggers          Dump triggers for each dumped table.
                      (Defaults to on; use --skip-triggers to disable.)
  --tz-utc            SET TIME_ZONE='+00:00' at top of dump to allow dumping of
                      TIMESTAMP data when a server has data in different time
                      zones or data is being moved between servers with
                      different time zones.
                      (Defaults to on; use --skip-tz-utc to disable.)
  -u, --user=name     User for login if not current user.
  -v, --verbose       Print info about the various stages.
  -V, --version       Output version information and exit.
  -w, --where=name    Dump only selected records. Quotes are mandatory.
  -X, --xml           Dump a database as well formed XML.
  --plugin-dir=name   Directory for client-side plugins.
  --default-auth=name Default authentication client-side plugin to use.

Variables (--variable-name=value)
and boolean options {FALSE|TRUE}  Value (after reading options)
--------------------------------- ----------------------------------------
all-databases                     FALSE
all-tablespaces                   FALSE
no-tablespaces                    FALSE
add-drop-database                 FALSE
add-drop-table                    TRUE
add-locks                         TRUE
allow-keywords                    FALSE
apply-slave-statements            FALSE
character-sets-dir                (No default value)
comments                          TRUE
compatible                        (No default value)
compact                           FALSE
complete-insert                   FALSE
compress                          FALSE
create-options                    TRUE
databases                         FALSE
debug-check                       FALSE
debug-info                        FALSE
default-character-set             utf8
delayed-insert                    FALSE
delete-master-logs                FALSE
disable-keys                      TRUE
dump-slave                        0
events                            FALSE
extended-insert                   TRUE
fields-terminated-by              (No default value)
fields-enclosed-by                (No default value)
fields-optionally-enclosed-by     (No default value)
fields-escaped-by                 (No default value)
flush-logs                        FALSE
flush-privileges                  FALSE
force                             FALSE
hex-blob                          FALSE
host                              (No default value)
include-master-host-port          FALSE
insert-ignore                     FALSE
lines-terminated-by               (No default value)
lock-all-tables                   FALSE
lock-tables                       TRUE
log-error                         (No default value)
master-data                       0
max-allowed-packet                25165824
net-buffer-length                 1046528
no-autocommit                     FALSE
no-create-db                      FALSE
no-create-info                    FALSE
no-data                           FALSE
order-by-primary                  FALSE
port                              0
quick                             TRUE
quote-names                       TRUE
replace                           FALSE
routines                          FALSE
set-charset                       TRUE
single-transaction                FALSE
dump-date                         TRUE
socket                            (No default value)
ssl                               FALSE
ssl-ca                            (No default value)
ssl-capath                        (No default value)
ssl-cert                          (No default value)
ssl-cipher                        (No default value)
ssl-key                           (No default value)
ssl-verify-server-cert            FALSE
tab                               (No default value)
triggers                          TRUE
tz-utc                            TRUE
user                              (No default value)
verbose                           FALSE
where                             (No default value)
plugin-dir                        (No default value)
default-auth                      (No default value)

Monday, 26 December 2016

[Maria/MySQL] Change Table Storage Engine (테이블 엔진 변경)

1. Check table storage engine (테이블 별 엔진 확인)

SELECT TABLE_SCHEMA,TABLE_NAME,ENGINE FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='[DB_NAME]';




2. Change storage engine (테이블 엔진 변경)

ALTER TABLE [TABLE_NAME] ENGINE='[STORAGE_ENGINE]';


Monday, 4 July 2016

[Maria/MySQL] How to allow remote client access database (원격 접속 허용 설정)

1. Connect database as root

#> mysql -uroot -p






2. Check current status

SELECT host FROM mysql.user WHERE user='[USER_NAME]';





3. Add remote authority

INSERT INTO mysql.user (host,user,password) VALUES ('[Allowed IP]', '[USER_NAME]', password('[PASSWORD]'));

GRANT ALL PRIVILEGES ON *.* TO '[USER_NAME]'@'[Allowed IP]';
FLUSH PRIVILEGES;



Wednesday, 8 June 2016

[Maria/MySQL] How to convert string to date

MariaDB(MySQL) has STR_TO_DATE function like TO_DATE in ORACLE.

ex)
SELECT STR_TO_DATE('2013-02-11', '%Y-%m-%d');


FormatDescription
%aAbbreviated weekday name (Sun..Sat)
%bAbbreviated month name (Jan..Dec)
%cMonth, numeric (0..12)
%DDay of the month with English suffix (0th, 1st, 2nd, 3rd, …)
%dDay of the month, numeric (00..31)
%eDay of the month, numeric (0..31)
%fMicroseconds (000000..999999)
%HHour (00..23)
%hHour (01..12)
%IHour (01..12)
%iMinutes, numeric (00..59)
%jDay of year (001..366)
%kHour (0..23)
%lHour (1..12)
%MMonth name (January..December)
%mMonth, numeric (00..12)
%pAM or PM
%rTime, 12-hour (hh:mm:ss followed by AM or PM)
%SSeconds (00..59)
%sSeconds (00..59)
%TTime, 24-hour (hh:mm:ss)
%UWeek (00..53), where Sunday is the first day of the week; WEEK() mode 0
%uWeek (00..53), where Monday is the first day of the week; WEEK() mode 1
%VWeek (01..53), where Sunday is the first day of the week; WEEK() mode 2; used with %X
%vWeek (01..53), where Monday is the first day of the week; WEEK() mode 3; used with %x
%WWeekday name (Sunday..Saturday)
%wDay of the week (0=Sunday..6=Saturday)
%XYear for the week where Sunday is the first day of the week, numeric, four digits; used with %V
%xYear for the week, where Monday is the first day of the week, numeric, four digits; used with %v
%YYear, numeric, four digits
%yYear, numeric (two digits)
%%A literal “%” character
%xx, for any “x” not listed above

Friday, 3 June 2016

[Maria/MySQL] Upsert(Merge) Statement

1. Insert ignoring duplication

ignore duplication row(s). skip duplicate data and insert only non-duplicate data.


INSERT IGNORE INTO <SOURCE_TABLE> VALUES (VALUE1, VALUE2...);

INSERT IGNORE INTO <SOURCE_TABLE> SELECT * FROM <TARGET_TABLE>;

2. Inserting new rows and updating existing rows

2.1. Using Standard SQL(OuterJoin)

It needs two-step process (insert and update). The benefit to this approach is standards compliance. But it is poor efficiency.

INSERT INTO <SOURCE_TABLE> (KEY_COL1, COL2, COL3)
    SELECT T.COL1, T.COL2, T.COL3
      FROM <TARGET_TABLE> T
     WHERE LEFT OUTER JOIN <SOURCE_TABLE> AS S
                        ON T.KEY_COL1 = S.KEY_COL1
WHERE S.KEY_COL1 IS NULL
;

UPDATE <TARGET_TABLE> AS  T
     INNER JOIN <SOURCE_TABLE> AS S             ON T.KEY_COL1 = S.KEY_COL1
    SET T.COL2 = S.COL2
      , T.COL3 = S.COL3
;

2.2. Using Standard SQL(OuterJoin)

This is far more efficient, but it still might be very bad. It could lock the tables for a long time with large datasets, and like all two-step processes, it is not transactional.


INSERT INTO <TARGET_TABLE> (KEY_COL1, COL2, COL3)
    SELECT S.COL1, S.COL2, S.COL3
      FROM <SOURCE_TABLE> S
     WHERE LEFT OUTER JOIN <SOURCE_TABLE> AS S
                        ON S.KEY_COL1 = T.KEY_COL1
WHERE T.KEY_COL1 IS NULL;
UPDATE <TARGET_TABLE> AS  T
     INNER JOIN <SOURCE_TABLE> AS S
             ON T.KEY_COL1 = S.KEY_COL1
    SET T.COL2 = S.COL2
      , T.COL3 = S.COL3
;

UPDATE <TARGET_TABLE> AS T
    INNER JOIN <SOURCE_TABLE> AS S
            ON T.KEY_COL1 = S.KEY_COL1
 SET T.COL2 = S.COL2
   , T.COL3 = S.COL3
 ;

INSERT INTO <TARGETTABLE> (KEY_COL1, COL2, COL3)
    SELECT S.KEY_COL1, S.COL2, S.COL3
      FROM <SOURCE_TABLE> AS S
       LEFT OUTER JOIN <TARGET_TABLE> AS T
          ON S.KEY_COL1 = T.KEY_COL1
      WHERE T.KEY_COL1 IS NULL
;

2.3. Using Non-standard ON DUPLICATE KEY UPDATE Statement

Recommend this way.

INSERT INTO <TARGET_TABLE> ( KEY_COL1, COL2, COL3)
  SELECT KEY_COL1, COL2, COL3 FROM <SOURCE_TABLE>
 ON DUPLICATE KEY UPDATE COL2 = <VALUE2>
                       , COL3 = <VALUE3>
; 

Tuesday, 31 May 2016

[Maria/MySQL] How to install TokuDB storage engine and set it enabled.(TokuDB 스토리지 엔진 설치 및 사용방법)

TokuDB is available on the following distributions:
DistributionIntroduced
CentOS 6 64-bit and newerMariaDB 5.5.36 and MariaDB 10.0.9
Debian 7 "wheezy"64-bit and newerMariaDB 5.5.33 and MariaDB 10.0.5
Fedora 19 64-bit and newerMariaDB 5.5.33 and MariaDB 10.0.5
openSUSE 13.1 64-bit and newerMariaDB 5.5.41 and MariaDB 10.0.15
Red Hat 6 64-bit and newerMariaDB 5.5.36 and MariaDB 10.0.9
Ubuntu 12.10 "quantal" 64-bit and newerMariaDB 5.5.33 and MariaDB 10.0.5

1. Installing TokuDB
TokuDB has been included with MariaDB since MariaDB 5.5.34 and MariaDB 10.0.6 and does not require separate installation.

1.1. Installing TokuDB on Fedora, RedHat, & CentOS

# yum install MariaDB-tokudb-engine

1.2. Installing TokuDB on Ubuntu & Debian

# apt-get install mariadb-tokudb-engine-5.5

I have 10.1.12 MariaDB. So don't not need to install tokudb engine package.

2. Enabling TokuDB

2.1. Enabling TokuDB in configuration file

It is applied after starting or restarting.

# vi /etc/my.cnf.d/tokudb.cnf
[mariadb]
# See https://mariadb.com/kb/en/how-to-enable-tokudb-in-mariadb/
# for instructions how to enable TokuDB
#
# See https://mariadb.com/kb/en/tokudb-differences/ for differences
# between TokuDB in MariaDB and TokuDB from http://www.tokutek.com/

plugin-load-add=ha_tokudb.so


2.2. Enabling TokuDB when MariaDB is running

# mysqld --plugin-load=ha_tokudb --plugin-dir=<MariaDB Library Directory>/plugin



2.3. Enabling TokuDB manually from the mysql command line

# mysql -uroot -p


INSTALL SONAME 'ha_tokudb';



3. Create TokuDB Engine Table

CREATE TABLE TB_IOT_DHT_DATA
(
 MCU_NO int NOT NULL COMMENT 'MCU번호',
 SENSOR_NO int NOT NULL COMMENT '센서번호',
 SENSOR_DT datetime NOT NULL COMMENT '센서일시',
 SERVER_DT datetime COMMENT '서버일시',
 HUMI double COMMENT '습도',
 TEMP_C double COMMENT '섭씨온도',
 TEMP_F double COMMENT '화씨온도',
 LOC_LAT double COMMENT '위도',
 LOC_LON double COMMENT '경도',
 VOLTAGE int COMMENT '전압',
 PRIMARY KEY (MCU_NO, SENSOR_NO, SENSOR_DT)
) COMMENT = '온습도수집데이터', ENGINE = 'TokuDB';

Saturday, 2 April 2016

[Maria/MySQL] How to check transaction isolation level and set isolation level.(트랜잭션 Isolation level 확인)

1. Check Trasaction Isolation Level

1-1. Global Level
SELECT @@global.tx_isolation;

1-2. Sesssion Level
SELECT @@tx_isolation;


2. Set Isolaction Level

2-1. Edit Configure file
[myslqd]
transaction-isolation = [READ-UNCOMMITTED | READ-COMMITTED | REPEATABLE-READ | SERIALIZABLE]

2-2. Using command
SET @@[SESSION | GLOBAL].tx_isolation = '[READ-UNCOMMITTED | READ-COMMITTED | REPEATABLE-READ | SERIALIZABLE]';

[Mraia/MySQL] InnoDB Trasaction Isolation Level

MariaDB에서는 다양한 Engine을 지원한다. 전신인 MySQL 5.5버전 이후로 MyISAM에서 InnoDB로 Default Engine으로 변경되었다.

InnoDB에서는 4가지 Isolation Level을 지원한다.

1. READ UNCOMMITED
 SELECT 명령문은 비-락킹 유형으로 실행되지만, 레코드의 예전 버전이 사용될 수도 있다. 따라서, 이러한 분리 레벨을 사용하면, 이러한 읽기 연산은 일관성을 갖지 못하게 된다. 이것을 소위 “더티 읽기 (dirty read)”라고 한다. 그렇지 않을 경우, 이러한 분리 레벨은 READ COMMITTED처럼 실행된다.

2. READ COMMITTED
 오라클과 유사한 분리 레벨. 모든 SELECT ... FOR UPDATE 및 SELECT ... LOCK IN SHARE MODE 명령문은 인덱스 레코드만을 잠그지만, 인덱스 레코드 앞에 있는 갭은 잠그지 않으며, 따라서 새로운 레코드를 잠겨 있는 레코드 다음에 자유롭게 삽입하는 것을 허용한다. 유니크 검색 조건과 함께 유니크 인덱스를 사용하는 UPDATE 및 DELETE 명령문은 찾게 되는 인덱스만을 잠그며, 인덱스 잎에 있는 갭을 잠그지는 않는다. 범위-타입 UPDATE 및 DELETE 명령문의 경우, InnoDB는 반드시 다음-키 또는 갭 잠금을 설정하고 범위 내에 있는 갭에 대해서는 다른 사용자의 삽입을 막아야 한다. 이것은 MySQL 리플리케이션과 복구가 동작하기 위해서는 “팬텀 열 (phantom rows)”이 반드시 막혀야 하기 때문이다.
 컨시스턴트 (consistent) 읽기 (consistent read)는 오라클과 동일한 동작을 실행한다: 각각의 컨시스턴트 (consistent) 읽기는, 동일한 트랜젝션 안에서라도, 자신의 최신 스냅샷을 설정하고 읽는다. Section 14.2.10.4, “컨시스턴트 (consistent) 비-락킹 (Non-Locking) 읽기”를 참조할 것.

3. REPEATABLE READ (Default)
 이것은 InnoDB. SELECT ... FOR UPDATE, SELECT ... LOCK IN SHARE MODE, UPDATE의 디폴트 분리 레벨이며,유니크 검색 조건과 함께 유니크 인덱스를 사용하는 DELETE 명령문은 발견한 인덱스만을 잠그며, 그 앞에 있는 갭은 잠그지 않는다. 다른 검색 조건을 사용하면, 이러한 연산은 다음-키 락킹을 적용하고, 다음-키 또는 갭 잠금을 사용해서 스캔한 인덱스 범위 락킹을 하며, 다른 사용자의 새로운 삽입을 막아 버린다.
 컨시스턴트 (consistent) 읽기의 경우, READ COMMITTED 분리 레벨과는 중요한 차이점이 존재한다: 동일 트랜젝션 내에서의 모든 컨시스턴트 (consistent) 읽기는 첫 번째 읽기에 의해 성립된 동일 스냅샷을 읽게 된다. 이것은, 만일 여러분이 몇몇 평이한 SELECT 명령문을 동일한 트랜젝션 안에 입력할 경우, 이러한 SELECT 명령문은 각각에 대해서도 일관성을 함께 가진다는 것을 의미하는 것이다. Section 14.2.10.4, “컨시스턴트 (consistent) 비-락킹 (Non-Locking) 읽기”를 참조할 것.

4. SERIALIZABLE
 이 레벨은 REPEATABLE READ과 유사하지만, InnoDB는 암시적으로 모든 SELECT 명령문을 SELECT ... LOCK IN SHARE MODE에 대해서 실행한다.