Introduction to MariaDB

J
JongJin LeeSoftware Developer em SYS4U I&C
Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee
Blog : http://ora-sysdba.tistory.com/
1
MariaDB : About MariaDB
Jong Jin Lee
SYS4U I&C EC Solution Lab / Software Engineer
Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee
Blog : http://ora-sysdba.tistory.com/
2
Agenda
• MariaDB ?
• Install MariaDB
• Starting MariaDB & Query Execution
Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee
Blog : http://ora-sysdba.tistory.com/
3
Percona Server
MariaDB : Feature
Free & Open Software
• Open source Software
• Developer Based on
MySQL Community
Version
• Patches, Bug fixes and
Feature enhancements
(MySQL Community +
Monty Program AB)
• Development,
Roadmap, Release
Cycle and Other issues
are Open for
community User
Feature enhanced
• New Storage Engine
(PBXT, XtraDB, Maria,
FederatedX)
• Virtual Columns
• Services for Plugins
• Optimization
• Enhancement roadmap
is publicly available on
the wiki
• Backward Compatible
• Percona Server
(Developer Based on
MySQL Server, Onther
MySQL Fork Version)
MySQL Source Code
Maria DB
Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee
Blog : http://ora-sysdba.tistory.com/
4
• MariaDB Server
• GNU General Public
License (“GPL”)
• Client Program / Library
• GUN Lesser General
Public License
(“LGPL”)
• Community Vesion
• GNU General Public
License (“GPL”)
MariaDB : Licensing Comparison
• Commercially licensed
• Companies choose
between Named User
and Per Processor
pricing models
• Standard vs. Enterprise
vs. Personal vs.
StandardOne
• Per Processor model
has multi-core
implications
• Dual licensed:
• GNU General Public
License (“GPL”)
• Commercial License
• MySQL in enterprise
use:
• Annual Subscription:
per server
• MySQL in embedded
use:
• License - per server
• Annual Support - per
server
• MySQL Cluster CGE:
• Annual Subscription
• License + Annual
Support
Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee
Blog : http://ora-sysdba.tistory.com/
5
MariaDB : Processes and Threads
Oracle DATABASE
HR SCOTT SH
Table
Index
DB
Schemas
Multi-
Processes
DATAFILE
Network
File
SMON
PMON
CKPT
DBWn
ARCx MYSQLD
My.CNF
INFORMATION
SCHEMA
ORADEMO TEST DB
Single –
Process
Multi
Threads
Table
Index
Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee
Blog : http://ora-sysdba.tistory.com/
6
MariaDB : Memory and Files
Oracle MySQL
Memory cache •PGA (per server process)
•Hash area •Join Buffer (per client session)
•Sort area •Sort Buffer (per client session)
•Stack area •stack (per client session)
•SGA
•Shared pool •(Query Cache)
•DB buffer cache •Key Buffer [MyISAM]
•InnoDB Buffer Cache [InnoDB]
•REDO log buffer •InnoDB Log Buffer [InnoDB]
Files •init.ora •my.cnf / my.ini
•System tablespace file •`mysql` directory
•User tablespace files •directories in `data` directory
•InnoDB tablespace files [InnoDB]
Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee
Blog : http://ora-sysdba.tistory.com/
7
MariaDB : Redo & Undo Logs
Oracle MySQL
REDO/UNDO
Logs
•REDO logs •InnoDB logs [InnoDB]
•Binary log
•Archive logs •Binary log
•UNDO tablespace files •InnoDB tablespace files [InnoDB]
Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee
Blog : http://ora-sysdba.tistory.com/
8
MariaDB : Security
Security Item Oracle MySQL
Built-in Accounts SYS, SYSTEM, others Root.
Object Privileges Handled GRANT, REVOKE GRANT, REVOKE. Host
consideration
Privilege Granularity Column, Row Column (row via view)
Group Management ROLES On Roadmap
SSL Supported Yes Yes
Encryption Transparent, RC4, DES, AES,
etc.
AES, DES, MD5 SHA1;
128/256
Auditing Audit subsystem Handled via logging
Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee
Blog : http://ora-sysdba.tistory.com/
9
MariaDB : Data Types
Oracle Datatype MySQL Datatype
CHAR, VARCHAR(2),
NCHAR, NVARCHAR
CHAR, VARCHAR, TEXT
CLOB, LONG LONGTEXT
RAW MEDIUMBLOB
LONG RAW, BLOB BLOB
BFILE None
Oracle Datatype MySQL Datatype
NUMBER, DECIMAL INT, BIGINT, DECIMAL
NUMBER (P,S), DECIMAL (P,S) DECIMAL (P,S)
REAL, DOUBLE DECIMAL
FLOAT DOUBLE
DATE, TIMESTAMP DATETIME,TIMESTAMP
Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee
Blog : http://ora-sysdba.tistory.com/
10
MariaDB : Storage Engine
Purpose MariaDB MySQL
Memory Engine Memory Memory
Based on Disk : Temp
Table Engine
Aria MyISAM
Transaction Engine XtraDB InnoDB
NOSQL Support Engine MariaDB 10.0 Over :Cassandra Memcached API (Plug-in)
Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee
Blog : http://ora-sysdba.tistory.com/
11
MariaDB : Comparison
MariaDB MySQL
Thread Pool MariaDB 5.1 Over MySQL 5.5 Enterprise (Not
Support Community Vesion)
Buffer Pool MariaDB 5.5 Over : XtraDB MySQL 5.6 Over : InnoDB
Support SSD
(Solid-state Drive)
MariaDB 5.5 Over : XtraDB
Virtual Columns MariaDB 5.2 Over
Role Management MariaDB 10.0 Over
Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee
Blog : http://ora-sysdba.tistory.com/
12
MariaDB : Version-specific compatibility
MariaDB MySQL
5.1, 5.2, 5.3 5.1
5.5, 10.0 5.5
Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee
Blog : http://ora-sysdba.tistory.com/
13
MariaDB : Installation Step
[root@sys4u ~]# groupadd -g 600 dba
[root@sys4u ~]# useradd -g 600 -u 605 mysql
[root@sys4u ~]# usermod -g 600 mysql
[root@sys4u ~]# usermod -u 605 mysql
[root@sys4u ~]# passwd mysql
Changing password for user mysql.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
# vi /etc/security/limits.conf
# Below the line
mysql soft nproc 8192
mysql hard nproc 16384
mysql soft nofile 8192
mysql hard nofile 65536
# vi /etc/pam.d/login
# Below the line
session required pam_limits.so
# vi /etc/profile
# Below the line
if [ $USER = "mysql" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee
Blog : http://ora-sysdba.tistory.com/
14
MariaDB : Installation Step
[root@sys4u ~]# mkdir -p /home/mariadb
[root@sys4u ~]# mkdir -p /home/data/mariadb-data
[root@sys4u ~]# mkdir -p /home/data/mariadb-tmp
[root@sys4u ~]# mkdir -p /home/data/mariadb-iblog
[root@sys4u ~]# mkdir -p /home/data/mariadb-binlog
[root@sys4u ~]# chown -R mysql:dba /home/mariadb/
[root@sys4u ~]# chown -R mysql:dba /home/data/*
[root@sys4u mariadb]# ls
cmake-2.8.4.tar.gz mariadb-5.5.30.tar.gz
[root@sys4u mariadb]# tar -xvf cmake-2.8.4
[root@sys4u mariadb]# ls
cmake-2.8.4 cmake-2.8.4.tar.gz mariadb-5.5.30.tar.gz
[root@sys4u mariadb]# cd cmake-2.8.4
[root@sys4u cmake-2.8.4]# ls
CMakeCPack.cmake ChangeLog.txt Source
CMakeCPackOptions.cmake.in CompileFlags.cmake Templates
CMakeGraphVizOptions.cmake Copyright.txt Tests
CMakeLists.txt DartConfig.cmake Utilities
CMakeLogo.gif DartLocal.conf.in bootstrap
CTestConfig.cmake Docs cmake.1
CTestCustom.cmake.in Example cmake_uninstall.cmake.in
CTestCustom.ctest.in Modules configure
ChangeLog.manual Readme.txt doxygen.config
[root@sys4u cmake-2.8.4]# ./bootstrap
---------------------------------------------
-----
-----
---------------------------------------------
Log of errors: /home/mariadb/cmake-2.8.4/Bootstrap.cmk/cmake_bootstrap.log
---------------------------------------------
Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee
Blog : http://ora-sysdba.tistory.com/
15
MariaDB : Installation Step
[[root@sys4u cmake-2.8.4]# yum -y install gcc-c++
-----
Loaded plugins: fastestmirror, security
base | 3.7 kB 00:00
base/primary_db | 4.4 MB 00:00
extras | 3.4 kB 00:00
extras/primary_db | 19 kB 00:00
updates | 3.4 kB 00:00
updates/primary_db | 3.2 MB 00:00
Setting up Install Process
Resolving Dependencies
--> Running transaction check
-----
[root@sys4u cmake-2.8.4]# ./bootstrap
-----
Makefile processor on this system is: gmake
g++ is GNU compiler
g++ has STL in std:: namespace
g++ has ANSI streams
g++ has streams in std:: namespace
g++ has sstream
g++ has operator!=(string, char*)
g++ has stl iterator_traits
g++ has standard template allocator
g++ has allocator<>::rebind<>
g++ does not have non-standard allocator<>::max_size argument
-----
[root@sys4u cmake-2.8.4]# make
-----
Scanning dependencies of target cmsys
[ 1%] Building C object Source/kwsys/CMakeFiles/cmsys.dir/Terminal.o
[ 2%] Building C object Source/kwsys/CMakeFiles/cmsys.dir/System.o
-----
Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee
Blog : http://ora-sysdba.tistory.com/
16
MariaDB : Installation Step
[root@sys4u cmake-2.8.4]# make install
-----
Install the project...
-- Install configuration: ""
-- Installing: /usr/local/doc/cmake-2.8/Copyright.txt
-- Installing: /usr/local/share/cmake-2.8/Modules
-- Installing: /usr/local/share/cmake-2.8/Modules/FindPerl.cmake
-- Installing: /usr/local/share/cmake-2.8/Modules/FindLibArchive.cmake
-- Installing: /usr/local/share/cmake-2.8/Modules/CMakeDetermineASMCompiler.cmake
-- Installing: /usr/local/share/cmake-2.8/Modules/CMakeExportBuildSettings.cmake
-- Installing: /usr/local/share/cmake-2.8/Modules/FindJPEG.cmake
-----
Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee
Blog : http://ora-sysdba.tistory.com/
17
MariaDB : Installation Step
# vi /etc/my.cnf
-----
#[mysqld]
#datadir=/var/lib/mysql
#socket=/var/lib/mysql/mysql.sock
#user=mysql
## Disabling symbolic-links is recommended to prevent assorted security risks
#symbolic-links=0
#[mysqld_safe]
#log-error=/var/log/mysqld.log
#pid-file=/var/run/mysqld/mysqld.pid
[client]
port = 3306
socket = /usr/local/mysql/mysql.socket
[mysqld]
# generic configuration options
port = 3306
socket = /usr/local/mysql/mysql.socket
back_log = 100
max_connections = 500
max_connect_errors = 10
table_open_cache = 2048
max_allowed_packet = 16M
join_buffer_size = 8M
read_buffer_size = 2M
read_rnd_buffer_size = 16M
sort_buffer_size = 8M
thread_stack = 192K
lower_case_table_names = 0
-----
Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee
Blog : http://ora-sysdba.tistory.com/
18
MariaDB : Installation Step
[root@sys4u cmake-2.8.4]# cd /home/mariadb/
[root@sys4u mariadb]# ls
cmake-2.8.4 cmake-2.8.4.tar.gz mariadb-5.5.30.tar.gz
[root@sys4u mariadb]# tar -xvf mariadb-5.5.30.tar.gz
-----
mariadb-5.5.30/mysql-test/suite/sys_vars/r/warning_count_basic.result
mariadb-5.5.30/mysql-test/suite/sys_vars/r/thread_stack_basic.result
mariadb-5.5.30/mysql-test/suite/sys_vars/r/default_week_format_basic.result
mariadb-5.5.30/mysql-test/suite/sys_vars/r/collation_server_basic.result
mariadb-5.5.30/mysql-test/suite/sys_vars/r/shared_memory_basic.result
mariadb-5.5.30/mysql-test/suite/sys_vars/r/innodb_log_group_home_dir_basic.result
mariadb-5.5.30/mysql-test/suite/sys_vars/r/slave_sql_verify_checksum_basic.result
mariadb-5.5.30/mysql-test/suite/sys_vars/r/innodb_merge_sort_block_size_basic.result
mariadb-5.5.30/mysql-test/suite/sys_vars/r/general_log_file_func.result
mariadb-5.5.30/mysql-test/suite/sys_vars/r/thread_pool_size_basic.result
mariadb-5.5.30/mysql-test/suite/sys_vars/r/sync_master_info_basic.result
-----
[root@sys4u mariadb-5.5.30]# /usr/local/bin/cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DDEFAULT_CHARSET=utf8
-DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS=all -DMYSQL_DATADIR=/usr/local/mysql/data -
DENABLED_LOCAL_INFILE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.socket
-----
-- Looking for access - found
-- Looking for aio_read
-- Looking for aio_read - found
-- Looking for alarm
-- Looking for alarm - found
-- Looking for backtrace
-- Looking for backtrace - found
-- Looking for backtrace_symbols
-- Looking for backtrace_symbols - found
-- Looking for backtrace_symbols_fd
-----
Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee
Blog : http://ora-sysdba.tistory.com/
19
MariaDB : Installation Step
[root@sys4u mysql]# chown -R mysql:dba /usr/local/mysql*
[root@sys4u mysql]# chown mysql:dba /etc/my.cnf
export MYSQL_HOME=/usr/local/mysql
export PATH=$PATH:$MYSQL_HOME/bin:.
export ADMIN_PWD="root password”
alias ll="ls -al --color=auto"
alias mydba="mysql -uroot -p$ADMIN_PWD"
alias mymaster="mysql -uroot -p$ADMIN_PWD -e'show master status;'"
alias myslave="mysql -uroot -p$ADMIN_PWD -e'show slave statusG'"
alias mh="cd $MYSQL_HOME"
alias md="cd /home/data/mariadb-data"
alias mt="cd /home/data/mariadb-tmp“
-----
[root@sys4u mysql]# cd /usr/local/mysql/
[root@sys4u mysql]# ./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql/
-----
WARNING: The host 'sys4u.co.kr' could not be looked up with resolveip.
This probably means that your libc libraries are not 100 % compatible
with this binary MariaDB version. The MariaDB daemon, mysqld, should work
normally with the exception that host name resolving will not work.
This means that you should use IP addresses instead of hostnames
when specifying MariaDB privileges !
Installing MariaDB/MySQL system tables in '/home/data/mariadb-data' ...
OK
-----
Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee
Blog : http://ora-sysdba.tistory.com/
20
MariaDB : Installation Step
[root@sys4u ~]# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
cp: overwrite `/etc/init.d/mysqld'? y
# /etc/init.d/mysqld
46 basedir=/home/mariadb
47 datadir=/home/data/mariadb-data
[root@sys4u ~]# /usr/local/mysql/bin/mysql
Welcome to the MariaDB monitor. Commands end with ; or g.
Your MariaDB connection id is 2
Server version: 5.5.30-MariaDB-log Source distribution
Copyright (c) 2000, 2013, Oracle, Monty Program Ab and others.
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
MariaDB [(none)]>
Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee
Blog : http://ora-sysdba.tistory.com/
21
MariaDB : Installation Step
MariaDB [(none)]> use mysql
Database changed
MariaDB [mysql]> create database orademo;
Query OK, 1 row affected (0.00 sec)
MariaDB [mysql]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| orademo |
| performance_schema |
| test |
+--------------------+
5 rows in set (0.00 sec)
MariaDB [mysql]> grant all privileges on *.* to 'root'@'%' identified by ‘’ecsses;
Query OK, 0 rows affected (0.03 sec)
MariaDB [mysql]> select host, user, password from user;
+-------------+------+-------------------------------------------+
| host | user | password |
+-------------+------+-------------------------------------------+
| localhost | root | |
| sys4u.co.kr | root | |
| 127.0.0.1 | root | |
| ::1 | root | |
| localhost | | |
| sys4u.co.kr | | |
| % | root | *077D2C382FBC8EF28EFF2EF07C9BAD1595F0AB6D |
+-------------+------+-------------------------------------------+
7 rows in set (0.00 sec)
MariaDB [mysql]> flush privileges;
Query OK, 0 rows affected (0.00 sec)
Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee
Blog : http://ora-sysdba.tistory.com/
22
MariaDB : MariaDB Server Startup & Shutdown
[root@sys4u ~]# /etc/init.d/mysqld start
Starting MySQL.... [ OK ]
[root@sys4u ~]# /usr/local/mysql/bin/mysql -uroot -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or g.
Your MariaDB connection id is 3
Server version: 5.5.37-tokudb-7.1.6-MariaDB-log MariaDB Server
Copyright (c) 2000, 2013, Oracle, Monty Program Ab and others.
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
MariaDB [(none)]> use mysql
Database changed
MariaDB [mysql]> exit
Bye
[root@sys4u ~]# /etc/init.d/mysqld stop
Shutting down MySQL.. [ OK ]
Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee
Blog : http://ora-sysdba.tistory.com/
23
MariaDB : Create DB & User
MariaDB [(none)]> create database firstdb; (or create database firstdb default charcter set utf8mb4;)
Query OK, 1 row affected (0.03 sec)
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| firstdb |
| mysql |
| orademo |
| performance_schema |
| test |
+--------------------+
6 rows in set (0.10 sec)
Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee
Blog : http://ora-sysdba.tistory.com/
24
MariaDB : Create DB & User
MariaDB [(none)]> create database firstdb; (or create database firstdb default charcter set utf8mb4;)
Query OK, 1 row affected (0.03 sec)
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| firstdb |
| mysql |
| orademo |
| performance_schema |
| test |
+--------------------+
6 rows in set (0.10 sec)
Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee
Blog : http://ora-sysdba.tistory.com/
25
MariaDB : Create Table
MariaDB [firstdb]> create table tab_test (
-> tid bigint not null auto_increment,
-> tname varchar(100) not null,
-> tmeno text not null,
-> primary key(tid),
-> index ix_tname_tid (tname, tid)
-> ) ENGINE=InnoDB;
MariaDB [firstdb]> show create table tab_test;
------------+
| Table | Create Table |
+----------+-----------------------------------------------------------------------------------------------------
| tab_test | CREATE TABLE `tab_test` (
`tid` bigint(20) NOT NULL AUTO_INCREMENT,
`tname` varchar(100) NOT NULL,
`tmeno` text NOT NULL,
PRIMARY KEY (`tid`),
KEY `ix_tname_tid` (`tname`,`tid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 |
+----------+-----------------------------------------------------------------------------------------------------
------------+
1 row in set (0.11 sec)
MariaDB [firstdb]> desc tab_test;
+-------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------+--------------+------+-----+---------+----------------+
| tid | bigint(20) | NO | PRI | NULL | auto_increment |
| tname | varchar(100) | NO | MUL | NULL | |
| tmeno | text | NO | | NULL | |
+-------+--------------+------+-----+---------+----------------+
3 rows in set (0.00 sec)
Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee
Blog : http://ora-sysdba.tistory.com/
26
MariaDB : Modify table (ONLINE/OFFLINE)
MariaDB [firstdb]> create table t1 (fd1 int, fd2 enum('red', 'green'));
Query OK, 0 rows affected (0.00 sec)
MariaDB [firstdb]> alter online table t1 modify fd2 enum('red', 'green', 'blue');
Query OK, 0 rows affected (0.01 sec)
Records: 0 Duplicates: 0 Warnings: 0
MariaDB [firstdb]> alter online table t1 add fd3 int;
ERROR 1915 (HY000): Can't execute the given 'ALTER' command as online
 Don't Need : Data Copy to Temp Table
– Modify Table Names
– Modify Column Names
– Modify Number Type Column Length
– Modify Table Comment
– ENUM Type item add
Online Modify Schema : MariaDB 10.0, MySQL 5.6 Over
Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee
Blog : http://ora-sysdba.tistory.com/
27
MariaDB : Modify table (ONLINE/OFFLINE)
MariaDB [firstdb]> alter table tab_test add created datetime not null;
Query OK, 0 rows affected (0.30 sec)
Records: 0 Duplicates: 0 Warnings: 0
MariaDB [firstdb]> alter table tab_test add index ix_created (created);
Query OK, 0 rows affected (0.18 sec)
Records: 0 Duplicates: 0 Warnings: 0
MariaDB [firstdb]> desc tab_test;
+---------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------+--------------+------+-----+---------+----------------+
| tid | bigint(20) | NO | PRI | NULL | auto_increment |
| tname | varchar(100) | NO | MUL | NULL | |
| tmeno | text | NO | | NULL | |
| created | datetime | NO | MUL | NULL | |
+---------+--------------+------+-----+---------+----------------+
4 rows in set (0.00 sec)
Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee
Blog : http://ora-sysdba.tistory.com/
28
MariaDB : DML (INSERT)
MariaDB [firstdb]> create table tab_test (
-> fd1 int not null,
-> fd2 varchar(50),
-> primary key(fd1)) engine=innodb;
Query OK, 0 rows affected (0.09 sec)
MariaDB [firstdb]> insert into tab_test (fd1, fd2) values (1,'Matt');
Query OK, 1 row affected (0.06 sec)
MariaDB [firstdb]> insert into tab_test values (2, 'Toto');
Query OK, 1 row affected (0.00 sec)
MariaDB [firstdb]> insert into tab_test(fd1, fd2)
-> values (3,'Lee') on duplicate key update fd2='Lee';
Query OK, 1 row affected (0.03 sec)
MariaDB [firstdb]> insert into tab_test(fd1, fd2)
-> values (3, 'SeongUck') on duplicate key update fd2='SeongUck';
Query OK, 2 rows affected (0.04 sec)
MariaDB [firstdb]> select * from tab_test;
+-----+----------+
| fd1 | fd2 |
+-----+----------+
| 1 | Matt |
| 2 | Toto |
| 3 | SeongUck |
+-----+----------+
3 rows in set (0.00 sec)
Option) ON DUPLICATE KEY UPDATE
Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee
Blog : http://ora-sysdba.tistory.com/
29
MariaDB : DML (SELECT)
MariaDB [firstdb]> select * from tab_test;
+-----+----------+
| fd1 | fd2 |
+-----+----------+
| 1 | Matt |
| 2 | Toto |
| 3 | SeongUck |
+-----+----------+
3 rows in set (0.00 sec)
MariaDB [firstdb]> select * from tab_testG;
*************************** 1. row ***************************
fd1: 1
fd2: Matt
*************************** 2. row ***************************
fd1: 2
fd2: Toto
*************************** 3. row ***************************
fd1: 3
fd2: SeongUck
3 rows in set (0.00 sec)
Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee
Blog : http://ora-sysdba.tistory.com/
30
MariaDB : DML (UPDATE)
MariaDB [firstdb]> update tab_test set fd2='Brandon' where fd1=1;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
MariaDB [firstdb]> select * from tab_test where fd1=1;
+-----+---------+
| fd1 | fd2 |
+-----+---------+
| 1 | Brandon |
+-----+---------+
1 row in set (0.06 sec)
MariaDB [firstdb]> select * from tab_test where fd1=1;
+-----+---------+
| fd1 | fd2 |
+-----+---------+
| 1 | Brandon |
+-----+---------+
1 row in set (0.06 sec)
MariaDB [firstdb]> update tab_test set fd2='Brandon';
Query OK, 2 rows affected (0.03 sec)
Rows matched: 3 Changed: 2 Warnings: 0
MariaDB [firstdb]> select * from tab_test;
+-----+---------+
| fd1 | fd2 |
+-----+---------+
| 1 | Brandon |
| 2 | Brandon |
| 3 | Brandon |
+-----+---------+
3 rows in set (0.01 sec)
caution
Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee
Blog : http://ora-sysdba.tistory.com/
31
MariaDB : DML (REPLACE)
MariaDB [firstdb]> replace tab_test set fd1=1, fd2='Matt';
Query OK, 2 rows affected (0.00 sec)
MariaDB [firstdb]> select * from tab_test where fd1=1;
+-----+------+
| fd1 | fd2 |
+-----+------+
| 1 | Matt |
+-----+------+
1 row in set (0.00 sec)
 REPLACE <-> UPDATE
– If, PK or Unique key : Recode Delete & Insert
– System Over head
– Recommended : INSERT INTO … ON DUPLICATE KEY UP-DATE
Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee
Blog : http://ora-sysdba.tistory.com/
32
MariaDB : DML (DELETE)
MariaDB [firstdb]> delete from tab_test where fd1=1;
Query OK, 0 rows affected (0.00 sec)
MariaDB [firstdb]> select * from tab_test;
+-----+---------+
| fd1 | fd2 |
+-----+---------+
| 2 | Brandon |
| 3 | Brandon |
+-----+---------+
2 rows in set (0.00 sec)
MariaDB : AUTO Commit
Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee
Blog : http://ora-sysdba.tistory.com/
33
Reference
 Presentation : Ryusuke Kajiyama (MySQL Sales Consulting Manager, JAPAC)
– State of the Dolphin
– MySQL for Oracle DB
 Site : MariaDB Knowledge Base
 Book : “Real MariaDB”
Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee
Blog : http://ora-sysdba.tistory.com/
34
Q & A
Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee
Blog : http://ora-sysdba.tistory.com/
35
1 de 35

Recomendados

Introduction of MariaDB 2017 09 por
Introduction of MariaDB 2017 09Introduction of MariaDB 2017 09
Introduction of MariaDB 2017 09GOTO Satoru
2.5K visualizações50 slides
Using all of the high availability options in MariaDB por
Using all of the high availability options in MariaDBUsing all of the high availability options in MariaDB
Using all of the high availability options in MariaDBMariaDB plc
2.9K visualizações31 slides
Running MariaDB in multiple data centers por
Running MariaDB in multiple data centersRunning MariaDB in multiple data centers
Running MariaDB in multiple data centersMariaDB plc
3.5K visualizações46 slides
How to migrate from Oracle Database with ease por
How to migrate from Oracle Database with easeHow to migrate from Oracle Database with ease
How to migrate from Oracle Database with easeMariaDB plc
1.1K visualizações49 slides
MariaDB: in-depth (hands on training in Seoul) por
MariaDB: in-depth (hands on training in Seoul)MariaDB: in-depth (hands on training in Seoul)
MariaDB: in-depth (hands on training in Seoul)Colin Charles
9.2K visualizações148 slides
The Proxy Wars - MySQL Router, ProxySQL, MariaDB MaxScale por
The Proxy Wars - MySQL Router, ProxySQL, MariaDB MaxScaleThe Proxy Wars - MySQL Router, ProxySQL, MariaDB MaxScale
The Proxy Wars - MySQL Router, ProxySQL, MariaDB MaxScaleColin Charles
13K visualizações21 slides

Mais conteúdo relacionado

Mais procurados

MariaDB Performance Tuning and Optimization por
MariaDB Performance Tuning and OptimizationMariaDB Performance Tuning and Optimization
MariaDB Performance Tuning and OptimizationMariaDB plc
11.3K visualizações51 slides
Scalability, Availability & Stability Patterns por
Scalability, Availability & Stability PatternsScalability, Availability & Stability Patterns
Scalability, Availability & Stability PatternsJonas Bonér
516K visualizações196 slides
Stability Patterns for Microservices por
Stability Patterns for MicroservicesStability Patterns for Microservices
Stability Patterns for Microservicespflueras
1.9K visualizações18 slides
Wars of MySQL Cluster ( InnoDB Cluster VS Galera ) por
Wars of MySQL Cluster ( InnoDB Cluster VS Galera ) Wars of MySQL Cluster ( InnoDB Cluster VS Galera )
Wars of MySQL Cluster ( InnoDB Cluster VS Galera ) Mydbops
2.5K visualizações42 slides
The Full MySQL and MariaDB Parallel Replication Tutorial por
The Full MySQL and MariaDB Parallel Replication TutorialThe Full MySQL and MariaDB Parallel Replication Tutorial
The Full MySQL and MariaDB Parallel Replication TutorialJean-François Gagné
3.3K visualizações113 slides
MySQL/MariaDB Proxy Software Test por
MySQL/MariaDB Proxy Software TestMySQL/MariaDB Proxy Software Test
MySQL/MariaDB Proxy Software TestI Goo Lee
2K visualizações16 slides

Mais procurados(20)

MariaDB Performance Tuning and Optimization por MariaDB plc
MariaDB Performance Tuning and OptimizationMariaDB Performance Tuning and Optimization
MariaDB Performance Tuning and Optimization
MariaDB plc11.3K visualizações
Scalability, Availability & Stability Patterns por Jonas Bonér
Scalability, Availability & Stability PatternsScalability, Availability & Stability Patterns
Scalability, Availability & Stability Patterns
Jonas Bonér516K visualizações
Stability Patterns for Microservices por pflueras
Stability Patterns for MicroservicesStability Patterns for Microservices
Stability Patterns for Microservices
pflueras1.9K visualizações
Wars of MySQL Cluster ( InnoDB Cluster VS Galera ) por Mydbops
Wars of MySQL Cluster ( InnoDB Cluster VS Galera ) Wars of MySQL Cluster ( InnoDB Cluster VS Galera )
Wars of MySQL Cluster ( InnoDB Cluster VS Galera )
Mydbops2.5K visualizações
The Full MySQL and MariaDB Parallel Replication Tutorial por Jean-François Gagné
The Full MySQL and MariaDB Parallel Replication TutorialThe Full MySQL and MariaDB Parallel Replication Tutorial
The Full MySQL and MariaDB Parallel Replication Tutorial
Jean-François Gagné3.3K visualizações
MySQL/MariaDB Proxy Software Test por I Goo Lee
MySQL/MariaDB Proxy Software TestMySQL/MariaDB Proxy Software Test
MySQL/MariaDB Proxy Software Test
I Goo Lee2K visualizações
The Complete MariaDB Server tutorial por Colin Charles
The Complete MariaDB Server tutorialThe Complete MariaDB Server tutorial
The Complete MariaDB Server tutorial
Colin Charles2.7K visualizações
MariaDB MaxScale por MariaDB plc
MariaDB MaxScaleMariaDB MaxScale
MariaDB MaxScale
MariaDB plc1.9K visualizações
Deploying MariaDB databases with containers at Nokia Networks por MariaDB plc
Deploying MariaDB databases with containers at Nokia NetworksDeploying MariaDB databases with containers at Nokia Networks
Deploying MariaDB databases with containers at Nokia Networks
MariaDB plc2.4K visualizações
Optimizing MariaDB for maximum performance por MariaDB plc
Optimizing MariaDB for maximum performanceOptimizing MariaDB for maximum performance
Optimizing MariaDB for maximum performance
MariaDB plc2.1K visualizações
MariaDB 10.11 key features overview for DBAs por Federico Razzoli
MariaDB 10.11 key features overview for DBAsMariaDB 10.11 key features overview for DBAs
MariaDB 10.11 key features overview for DBAs
Federico Razzoli143 visualizações
ProxySQL for MySQL por Mydbops
ProxySQL for MySQLProxySQL for MySQL
ProxySQL for MySQL
Mydbops4.3K visualizações
How Safe is Asynchronous Master-Master Setup? por Sveta Smirnova
 How Safe is Asynchronous Master-Master Setup? How Safe is Asynchronous Master-Master Setup?
How Safe is Asynchronous Master-Master Setup?
Sveta Smirnova505 visualizações
Best Practice for Achieving High Availability in MariaDB por MariaDB plc
Best Practice for Achieving High Availability in MariaDBBest Practice for Achieving High Availability in MariaDB
Best Practice for Achieving High Availability in MariaDB
MariaDB plc4.2K visualizações
Kafka PPT.pptx por SRIRAMKIRAN9
Kafka PPT.pptxKafka PPT.pptx
Kafka PPT.pptx
SRIRAMKIRAN976 visualizações
ProxySQL High Avalability and Configuration Management Overview por René Cannaò
ProxySQL High Avalability and Configuration Management OverviewProxySQL High Avalability and Configuration Management Overview
ProxySQL High Avalability and Configuration Management Overview
René Cannaò372 visualizações
Introduction to MongoDB por Mike Dirolf
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
Mike Dirolf38.4K visualizações

Destaque

MariaDB 10: The Complete Tutorial por
MariaDB 10: The Complete TutorialMariaDB 10: The Complete Tutorial
MariaDB 10: The Complete TutorialColin Charles
33K visualizações149 slides
Why MariaDB? por
Why MariaDB?Why MariaDB?
Why MariaDB?Colin Charles
6.7K visualizações33 slides
A beginners guide to MariaDB por
A beginners guide to MariaDBA beginners guide to MariaDB
A beginners guide to MariaDBColin Charles
12.6K visualizações26 slides
MariaDB - Fast, Easy & Strong - Get Started Tutorial por
MariaDB - Fast, Easy & Strong - Get Started TutorialMariaDB - Fast, Easy & Strong - Get Started Tutorial
MariaDB - Fast, Easy & Strong - Get Started Tutorialphamhphuc
5.8K visualizações43 slides
MariaDB Galera Cluster presentation por
MariaDB Galera Cluster presentationMariaDB Galera Cluster presentation
MariaDB Galera Cluster presentationFrancisco Gonçalves
4.3K visualizações34 slides
Maria db vs mysql por
Maria db vs mysqlMaria db vs mysql
Maria db vs mysqlNitin KR
1.5K visualizações8 slides

Destaque(20)

MariaDB 10: The Complete Tutorial por Colin Charles
MariaDB 10: The Complete TutorialMariaDB 10: The Complete Tutorial
MariaDB 10: The Complete Tutorial
Colin Charles33K visualizações
Why MariaDB? por Colin Charles
Why MariaDB?Why MariaDB?
Why MariaDB?
Colin Charles6.7K visualizações
A beginners guide to MariaDB por Colin Charles
A beginners guide to MariaDBA beginners guide to MariaDB
A beginners guide to MariaDB
Colin Charles12.6K visualizações
MariaDB - Fast, Easy & Strong - Get Started Tutorial por phamhphuc
MariaDB - Fast, Easy & Strong - Get Started TutorialMariaDB - Fast, Easy & Strong - Get Started Tutorial
MariaDB - Fast, Easy & Strong - Get Started Tutorial
phamhphuc5.8K visualizações
MariaDB Galera Cluster presentation por Francisco Gonçalves
MariaDB Galera Cluster presentationMariaDB Galera Cluster presentation
MariaDB Galera Cluster presentation
Francisco Gonçalves4.3K visualizações
Maria db vs mysql por Nitin KR
Maria db vs mysqlMaria db vs mysql
Maria db vs mysql
Nitin KR1.5K visualizações
The Complete MariaDB Server Tutorial - Percona Live 2015 por Colin Charles
The Complete MariaDB Server Tutorial - Percona Live 2015The Complete MariaDB Server Tutorial - Percona Live 2015
The Complete MariaDB Server Tutorial - Percona Live 2015
Colin Charles6.6K visualizações
Elk stack por Jilles van Gurp
Elk stackElk stack
Elk stack
Jilles van Gurp30.5K visualizações
Apache Spark 2.0: Faster, Easier, and Smarter por Databricks
Apache Spark 2.0: Faster, Easier, and SmarterApache Spark 2.0: Faster, Easier, and Smarter
Apache Spark 2.0: Faster, Easier, and Smarter
Databricks10.5K visualizações
Introduction to Apache Kafka por Jeff Holoman
Introduction to Apache KafkaIntroduction to Apache Kafka
Introduction to Apache Kafka
Jeff Holoman52.2K visualizações
Seminar Presentation Hadoop por Varun Narang
Seminar Presentation HadoopSeminar Presentation Hadoop
Seminar Presentation Hadoop
Varun Narang81.5K visualizações
State of MariaDB por Monty Program
State of MariaDBState of MariaDB
State of MariaDB
Monty Program2.8K visualizações
MariaDB Optimizer por JongJin Lee
MariaDB OptimizerMariaDB Optimizer
MariaDB Optimizer
JongJin Lee2.8K visualizações
MariaDB 10 Tutorial - 13.11.11 - Percona Live London por Ivan Zoratti
MariaDB 10 Tutorial - 13.11.11 - Percona Live LondonMariaDB 10 Tutorial - 13.11.11 - Percona Live London
MariaDB 10 Tutorial - 13.11.11 - Percona Live London
Ivan Zoratti4.6K visualizações
Introducción a los Modelos De Datos por esacre
Introducción a los Modelos De DatosIntroducción a los Modelos De Datos
Introducción a los Modelos De Datos
esacre5.7K visualizações
Unidad 2. modelo entidad relacion por LuiS YmAY
Unidad 2. modelo entidad relacionUnidad 2. modelo entidad relacion
Unidad 2. modelo entidad relacion
LuiS YmAY14.7K visualizações
Oracle University - Your Complete Training Source for Oracle Software and Har... por ORACLE USER GROUP ESTONIA
Oracle University - Your Complete Training Source for Oracle Software and Har...Oracle University - Your Complete Training Source for Oracle Software and Har...
Oracle University - Your Complete Training Source for Oracle Software and Har...
ORACLE USER GROUP ESTONIA3K visualizações
Maria DB Galera Cluster for High Availability por OSSCube
Maria DB Galera Cluster for High AvailabilityMaria DB Galera Cluster for High Availability
Maria DB Galera Cluster for High Availability
OSSCube2.2K visualizações
Node.js vs Play Framework (with Japanese subtitles) por Yevgeniy Brikman
Node.js vs Play Framework (with Japanese subtitles)Node.js vs Play Framework (with Japanese subtitles)
Node.js vs Play Framework (with Japanese subtitles)
Yevgeniy Brikman42.5K visualizações

Similar a Introduction to MariaDB

Maria db the new mysql (Colin Charles) por
Maria db the new mysql (Colin Charles)Maria db the new mysql (Colin Charles)
Maria db the new mysql (Colin Charles)Ontico
1.7K visualizações46 slides
MariaDB 10.0 - SkySQL Paris Meetup por
MariaDB 10.0 - SkySQL Paris MeetupMariaDB 10.0 - SkySQL Paris Meetup
MariaDB 10.0 - SkySQL Paris MeetupMariaDB Corporation
4.5K visualizações48 slides
MySQL Scalability and Reliability for Replicated Environment por
MySQL Scalability and Reliability for Replicated EnvironmentMySQL Scalability and Reliability for Replicated Environment
MySQL Scalability and Reliability for Replicated EnvironmentJean-François Gagné
877 visualizações60 slides
Differences between MariaDB 10.3 & MySQL 8.0 por
Differences between MariaDB 10.3 & MySQL 8.0Differences between MariaDB 10.3 & MySQL 8.0
Differences between MariaDB 10.3 & MySQL 8.0Colin Charles
3.5K visualizações58 slides
MariaDB und mehr - MariaDB Roadshow Summer 2014 Hamburg Berlin Frankfurt por
MariaDB und mehr - MariaDB Roadshow Summer 2014 Hamburg Berlin FrankfurtMariaDB und mehr - MariaDB Roadshow Summer 2014 Hamburg Berlin Frankfurt
MariaDB und mehr - MariaDB Roadshow Summer 2014 Hamburg Berlin FrankfurtMariaDB Corporation
980 visualizações33 slides
MySQL Scalability and Reliability for Replicated Environment por
MySQL Scalability and Reliability for Replicated EnvironmentMySQL Scalability and Reliability for Replicated Environment
MySQL Scalability and Reliability for Replicated EnvironmentJean-François Gagné
1.3K visualizações53 slides

Similar a Introduction to MariaDB(20)

Maria db the new mysql (Colin Charles) por Ontico
Maria db the new mysql (Colin Charles)Maria db the new mysql (Colin Charles)
Maria db the new mysql (Colin Charles)
Ontico1.7K visualizações
MariaDB 10.0 - SkySQL Paris Meetup por MariaDB Corporation
MariaDB 10.0 - SkySQL Paris MeetupMariaDB 10.0 - SkySQL Paris Meetup
MariaDB 10.0 - SkySQL Paris Meetup
MariaDB Corporation4.5K visualizações
MySQL Scalability and Reliability for Replicated Environment por Jean-François Gagné
MySQL Scalability and Reliability for Replicated EnvironmentMySQL Scalability and Reliability for Replicated Environment
MySQL Scalability and Reliability for Replicated Environment
Jean-François Gagné877 visualizações
Differences between MariaDB 10.3 & MySQL 8.0 por Colin Charles
Differences between MariaDB 10.3 & MySQL 8.0Differences between MariaDB 10.3 & MySQL 8.0
Differences between MariaDB 10.3 & MySQL 8.0
Colin Charles3.5K visualizações
MariaDB und mehr - MariaDB Roadshow Summer 2014 Hamburg Berlin Frankfurt por MariaDB Corporation
MariaDB und mehr - MariaDB Roadshow Summer 2014 Hamburg Berlin FrankfurtMariaDB und mehr - MariaDB Roadshow Summer 2014 Hamburg Berlin Frankfurt
MariaDB und mehr - MariaDB Roadshow Summer 2014 Hamburg Berlin Frankfurt
MariaDB Corporation980 visualizações
MySQL Scalability and Reliability for Replicated Environment por Jean-François Gagné
MySQL Scalability and Reliability for Replicated EnvironmentMySQL Scalability and Reliability for Replicated Environment
MySQL Scalability and Reliability for Replicated Environment
Jean-François Gagné1.3K visualizações
MariaDB 10.2 & MariaDB 10.1 by Michael Monty Widenius at Database Camp 2016 @ UN por ✔ Eric David Benari, PMP
MariaDB 10.2 & MariaDB 10.1 by Michael Monty Widenius at Database Camp 2016 @ UNMariaDB 10.2 & MariaDB 10.1 by Michael Monty Widenius at Database Camp 2016 @ UN
MariaDB 10.2 & MariaDB 10.1 by Michael Monty Widenius at Database Camp 2016 @ UN
✔ Eric David Benari, PMP6.6K visualizações
A26 MariaDB : The New&Implemented MySQL Branch by Colin Charles por Insight Technology, Inc.
A26 MariaDB : The New&Implemented MySQL Branch by Colin CharlesA26 MariaDB : The New&Implemented MySQL Branch by Colin Charles
A26 MariaDB : The New&Implemented MySQL Branch by Colin Charles
Insight Technology, Inc.984 visualizações
The New MariaDB Offering: MariaDB 10, MaxScale and More por MariaDB Corporation
The New MariaDB Offering: MariaDB 10, MaxScale and MoreThe New MariaDB Offering: MariaDB 10, MaxScale and More
The New MariaDB Offering: MariaDB 10, MaxScale and More
MariaDB Corporation7K visualizações
MariaDB Enterprise & MariaDB Enterprise Cluster - MariaDB Webinar July 2014 por MariaDB Corporation
MariaDB Enterprise & MariaDB Enterprise Cluster - MariaDB Webinar July 2014MariaDB Enterprise & MariaDB Enterprise Cluster - MariaDB Webinar July 2014
MariaDB Enterprise & MariaDB Enterprise Cluster - MariaDB Webinar July 2014
MariaDB Corporation777 visualizações
Best practices for MySQL High Availability Tutorial por Colin Charles
Best practices for MySQL High Availability TutorialBest practices for MySQL High Availability Tutorial
Best practices for MySQL High Availability Tutorial
Colin Charles4.9K visualizações
MariaDB 10 and Beyond por MariaDB Corporation
MariaDB 10 and BeyondMariaDB 10 and Beyond
MariaDB 10 and Beyond
MariaDB Corporation1.1K visualizações
Azure Nights August2017 por Michael Frank
Azure Nights August2017Azure Nights August2017
Azure Nights August2017
Michael Frank374 visualizações
Meet MariaDB 10.1 at the Bulgaria Web Summit por Colin Charles
Meet MariaDB 10.1 at the Bulgaria Web SummitMeet MariaDB 10.1 at the Bulgaria Web Summit
Meet MariaDB 10.1 at the Bulgaria Web Summit
Colin Charles530 visualizações
AAI-4847 Full Disclosure on the Performance Characteristics of WebSphere Appl... por WASdev Community
AAI-4847 Full Disclosure on the Performance Characteristics of WebSphere Appl...AAI-4847 Full Disclosure on the Performance Characteristics of WebSphere Appl...
AAI-4847 Full Disclosure on the Performance Characteristics of WebSphere Appl...
WASdev Community9.8K visualizações
MySQL Day Paris 2018 - MySQL InnoDB Cluster; A complete High Availability sol... por Olivier DASINI
MySQL Day Paris 2018 - MySQL InnoDB Cluster; A complete High Availability sol...MySQL Day Paris 2018 - MySQL InnoDB Cluster; A complete High Availability sol...
MySQL Day Paris 2018 - MySQL InnoDB Cluster; A complete High Availability sol...
Olivier DASINI5.4K visualizações
MariaDB 5.5 and what comes next - Percona Live NYC 2012 por Colin Charles
MariaDB 5.5 and what comes next - Percona Live NYC 2012MariaDB 5.5 and what comes next - Percona Live NYC 2012
MariaDB 5.5 and what comes next - Percona Live NYC 2012
Colin Charles1.3K visualizações
The New MariaDB Offering - MariaDB 10, MaxScale and more por MariaDB Corporation
The New MariaDB Offering - MariaDB 10, MaxScale and moreThe New MariaDB Offering - MariaDB 10, MaxScale and more
The New MariaDB Offering - MariaDB 10, MaxScale and more
MariaDB Corporation1.5K visualizações
Getting started with MariaDB with Docker por MariaDB plc
Getting started with MariaDB with DockerGetting started with MariaDB with Docker
Getting started with MariaDB with Docker
MariaDB plc713 visualizações
20190817 coscup-oracle my sql innodb cluster sharing por Ivan Ma
20190817 coscup-oracle my sql innodb cluster sharing20190817 coscup-oracle my sql innodb cluster sharing
20190817 coscup-oracle my sql innodb cluster sharing
Ivan Ma322 visualizações

Último

Chapter 3b- Process Communication (1) (1)(1) (1).pptx por
Chapter 3b- Process Communication (1) (1)(1) (1).pptxChapter 3b- Process Communication (1) (1)(1) (1).pptx
Chapter 3b- Process Communication (1) (1)(1) (1).pptxayeshabaig2004
7 visualizações30 slides
Organic Shopping in Google Analytics 4.pdf por
Organic Shopping in Google Analytics 4.pdfOrganic Shopping in Google Analytics 4.pdf
Organic Shopping in Google Analytics 4.pdfGA4 Tutorials
16 visualizações13 slides
[DSC Europe 23][AI:CSI] Dragan Pleskonjic - AI Impact on Cybersecurity and P... por
[DSC Europe 23][AI:CSI]  Dragan Pleskonjic - AI Impact on Cybersecurity and P...[DSC Europe 23][AI:CSI]  Dragan Pleskonjic - AI Impact on Cybersecurity and P...
[DSC Europe 23][AI:CSI] Dragan Pleskonjic - AI Impact on Cybersecurity and P...DataScienceConferenc1
8 visualizações36 slides
CRIJ4385_Death Penalty_F23.pptx por
CRIJ4385_Death Penalty_F23.pptxCRIJ4385_Death Penalty_F23.pptx
CRIJ4385_Death Penalty_F23.pptxyvettemm100
7 visualizações24 slides
[DSC Europe 23][Cryptica] Martin_Summer_Digital_central_bank_money_Ideas_init... por
[DSC Europe 23][Cryptica] Martin_Summer_Digital_central_bank_money_Ideas_init...[DSC Europe 23][Cryptica] Martin_Summer_Digital_central_bank_money_Ideas_init...
[DSC Europe 23][Cryptica] Martin_Summer_Digital_central_bank_money_Ideas_init...DataScienceConferenc1
5 visualizações18 slides
[DSC Europe 23] Spela Poklukar & Tea Brasanac - Retrieval Augmented Generation por
[DSC Europe 23] Spela Poklukar & Tea Brasanac - Retrieval Augmented Generation[DSC Europe 23] Spela Poklukar & Tea Brasanac - Retrieval Augmented Generation
[DSC Europe 23] Spela Poklukar & Tea Brasanac - Retrieval Augmented GenerationDataScienceConferenc1
15 visualizações29 slides

Último(20)

Chapter 3b- Process Communication (1) (1)(1) (1).pptx por ayeshabaig2004
Chapter 3b- Process Communication (1) (1)(1) (1).pptxChapter 3b- Process Communication (1) (1)(1) (1).pptx
Chapter 3b- Process Communication (1) (1)(1) (1).pptx
ayeshabaig20047 visualizações
Organic Shopping in Google Analytics 4.pdf por GA4 Tutorials
Organic Shopping in Google Analytics 4.pdfOrganic Shopping in Google Analytics 4.pdf
Organic Shopping in Google Analytics 4.pdf
GA4 Tutorials16 visualizações
[DSC Europe 23][AI:CSI] Dragan Pleskonjic - AI Impact on Cybersecurity and P... por DataScienceConferenc1
[DSC Europe 23][AI:CSI]  Dragan Pleskonjic - AI Impact on Cybersecurity and P...[DSC Europe 23][AI:CSI]  Dragan Pleskonjic - AI Impact on Cybersecurity and P...
[DSC Europe 23][AI:CSI] Dragan Pleskonjic - AI Impact on Cybersecurity and P...
DataScienceConferenc18 visualizações
CRIJ4385_Death Penalty_F23.pptx por yvettemm100
CRIJ4385_Death Penalty_F23.pptxCRIJ4385_Death Penalty_F23.pptx
CRIJ4385_Death Penalty_F23.pptx
yvettemm1007 visualizações
[DSC Europe 23][Cryptica] Martin_Summer_Digital_central_bank_money_Ideas_init... por DataScienceConferenc1
[DSC Europe 23][Cryptica] Martin_Summer_Digital_central_bank_money_Ideas_init...[DSC Europe 23][Cryptica] Martin_Summer_Digital_central_bank_money_Ideas_init...
[DSC Europe 23][Cryptica] Martin_Summer_Digital_central_bank_money_Ideas_init...
DataScienceConferenc15 visualizações
[DSC Europe 23] Spela Poklukar & Tea Brasanac - Retrieval Augmented Generation por DataScienceConferenc1
[DSC Europe 23] Spela Poklukar & Tea Brasanac - Retrieval Augmented Generation[DSC Europe 23] Spela Poklukar & Tea Brasanac - Retrieval Augmented Generation
[DSC Europe 23] Spela Poklukar & Tea Brasanac - Retrieval Augmented Generation
DataScienceConferenc115 visualizações
[DSC Europe 23] Danijela Horak - The Innovator’s Dilemma: to Build or Not to ... por DataScienceConferenc1
[DSC Europe 23] Danijela Horak - The Innovator’s Dilemma: to Build or Not to ...[DSC Europe 23] Danijela Horak - The Innovator’s Dilemma: to Build or Not to ...
[DSC Europe 23] Danijela Horak - The Innovator’s Dilemma: to Build or Not to ...
DataScienceConferenc15 visualizações
[DSC Europe 23] Zsolt Feleki - Machine Translation should we trust it.pptx por DataScienceConferenc1
[DSC Europe 23] Zsolt Feleki - Machine Translation should we trust it.pptx[DSC Europe 23] Zsolt Feleki - Machine Translation should we trust it.pptx
[DSC Europe 23] Zsolt Feleki - Machine Translation should we trust it.pptx
DataScienceConferenc15 visualizações
[DSC Europe 23][AI:CSI] Aleksa Stojanovic - Applying AI for Threat Detection ... por DataScienceConferenc1
[DSC Europe 23][AI:CSI] Aleksa Stojanovic - Applying AI for Threat Detection ...[DSC Europe 23][AI:CSI] Aleksa Stojanovic - Applying AI for Threat Detection ...
[DSC Europe 23][AI:CSI] Aleksa Stojanovic - Applying AI for Threat Detection ...
DataScienceConferenc16 visualizações
[DSC Europe 23] Stefan Mrsic_Goran Savic - Evolving Technology Excellence.pptx por DataScienceConferenc1
[DSC Europe 23] Stefan Mrsic_Goran Savic - Evolving Technology Excellence.pptx[DSC Europe 23] Stefan Mrsic_Goran Savic - Evolving Technology Excellence.pptx
[DSC Europe 23] Stefan Mrsic_Goran Savic - Evolving Technology Excellence.pptx
DataScienceConferenc16 visualizações
VoxelNet por taeseon ryu
VoxelNetVoxelNet
VoxelNet
taeseon ryu13 visualizações
apple.pptx por honeybeeqwe
apple.pptxapple.pptx
apple.pptx
honeybeeqwe5 visualizações
[DSC Europe 23] Aleksandar Tomcic - Adversarial Attacks por DataScienceConferenc1
[DSC Europe 23] Aleksandar Tomcic - Adversarial Attacks[DSC Europe 23] Aleksandar Tomcic - Adversarial Attacks
[DSC Europe 23] Aleksandar Tomcic - Adversarial Attacks
DataScienceConferenc15 visualizações
Ukraine Infographic_22NOV2023_v2.pdf por AnastosiyaGurin
Ukraine Infographic_22NOV2023_v2.pdfUkraine Infographic_22NOV2023_v2.pdf
Ukraine Infographic_22NOV2023_v2.pdf
AnastosiyaGurin1.4K visualizações
[DSC Europe 23] Predrag Ilic & Simeon Rilling - From Data Lakes to Data Mesh ... por DataScienceConferenc1
[DSC Europe 23] Predrag Ilic & Simeon Rilling - From Data Lakes to Data Mesh ...[DSC Europe 23] Predrag Ilic & Simeon Rilling - From Data Lakes to Data Mesh ...
[DSC Europe 23] Predrag Ilic & Simeon Rilling - From Data Lakes to Data Mesh ...
DataScienceConferenc18 visualizações
PRIVACY AWRE PERSONAL DATA STORAGE por antony420421
PRIVACY AWRE PERSONAL DATA STORAGEPRIVACY AWRE PERSONAL DATA STORAGE
PRIVACY AWRE PERSONAL DATA STORAGE
antony4204215 visualizações
Advanced_Recommendation_Systems_Presentation.pptx por neeharikasingh29
Advanced_Recommendation_Systems_Presentation.pptxAdvanced_Recommendation_Systems_Presentation.pptx
Advanced_Recommendation_Systems_Presentation.pptx
neeharikasingh295 visualizações
[DSC Europe 23] Milos Grubjesic Empowering Business with Pepsico s Advanced M... por DataScienceConferenc1
[DSC Europe 23] Milos Grubjesic Empowering Business with Pepsico s Advanced M...[DSC Europe 23] Milos Grubjesic Empowering Business with Pepsico s Advanced M...
[DSC Europe 23] Milos Grubjesic Empowering Business with Pepsico s Advanced M...
DataScienceConferenc17 visualizações
OECD-Persol Holdings Workshop on Advancing Employee Well-being in Business an... por StatsCommunications
OECD-Persol Holdings Workshop on Advancing Employee Well-being in Business an...OECD-Persol Holdings Workshop on Advancing Employee Well-being in Business an...
OECD-Persol Holdings Workshop on Advancing Employee Well-being in Business an...
StatsCommunications5 visualizações

Introduction to MariaDB

  • 1. Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee Blog : http://ora-sysdba.tistory.com/ 1 MariaDB : About MariaDB Jong Jin Lee SYS4U I&C EC Solution Lab / Software Engineer
  • 2. Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee Blog : http://ora-sysdba.tistory.com/ 2 Agenda • MariaDB ? • Install MariaDB • Starting MariaDB & Query Execution
  • 3. Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee Blog : http://ora-sysdba.tistory.com/ 3 Percona Server MariaDB : Feature Free & Open Software • Open source Software • Developer Based on MySQL Community Version • Patches, Bug fixes and Feature enhancements (MySQL Community + Monty Program AB) • Development, Roadmap, Release Cycle and Other issues are Open for community User Feature enhanced • New Storage Engine (PBXT, XtraDB, Maria, FederatedX) • Virtual Columns • Services for Plugins • Optimization • Enhancement roadmap is publicly available on the wiki • Backward Compatible • Percona Server (Developer Based on MySQL Server, Onther MySQL Fork Version) MySQL Source Code Maria DB
  • 4. Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee Blog : http://ora-sysdba.tistory.com/ 4 • MariaDB Server • GNU General Public License (“GPL”) • Client Program / Library • GUN Lesser General Public License (“LGPL”) • Community Vesion • GNU General Public License (“GPL”) MariaDB : Licensing Comparison • Commercially licensed • Companies choose between Named User and Per Processor pricing models • Standard vs. Enterprise vs. Personal vs. StandardOne • Per Processor model has multi-core implications • Dual licensed: • GNU General Public License (“GPL”) • Commercial License • MySQL in enterprise use: • Annual Subscription: per server • MySQL in embedded use: • License - per server • Annual Support - per server • MySQL Cluster CGE: • Annual Subscription • License + Annual Support
  • 5. Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee Blog : http://ora-sysdba.tistory.com/ 5 MariaDB : Processes and Threads Oracle DATABASE HR SCOTT SH Table Index DB Schemas Multi- Processes DATAFILE Network File SMON PMON CKPT DBWn ARCx MYSQLD My.CNF INFORMATION SCHEMA ORADEMO TEST DB Single – Process Multi Threads Table Index
  • 6. Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee Blog : http://ora-sysdba.tistory.com/ 6 MariaDB : Memory and Files Oracle MySQL Memory cache •PGA (per server process) •Hash area •Join Buffer (per client session) •Sort area •Sort Buffer (per client session) •Stack area •stack (per client session) •SGA •Shared pool •(Query Cache) •DB buffer cache •Key Buffer [MyISAM] •InnoDB Buffer Cache [InnoDB] •REDO log buffer •InnoDB Log Buffer [InnoDB] Files •init.ora •my.cnf / my.ini •System tablespace file •`mysql` directory •User tablespace files •directories in `data` directory •InnoDB tablespace files [InnoDB]
  • 7. Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee Blog : http://ora-sysdba.tistory.com/ 7 MariaDB : Redo & Undo Logs Oracle MySQL REDO/UNDO Logs •REDO logs •InnoDB logs [InnoDB] •Binary log •Archive logs •Binary log •UNDO tablespace files •InnoDB tablespace files [InnoDB]
  • 8. Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee Blog : http://ora-sysdba.tistory.com/ 8 MariaDB : Security Security Item Oracle MySQL Built-in Accounts SYS, SYSTEM, others Root. Object Privileges Handled GRANT, REVOKE GRANT, REVOKE. Host consideration Privilege Granularity Column, Row Column (row via view) Group Management ROLES On Roadmap SSL Supported Yes Yes Encryption Transparent, RC4, DES, AES, etc. AES, DES, MD5 SHA1; 128/256 Auditing Audit subsystem Handled via logging
  • 9. Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee Blog : http://ora-sysdba.tistory.com/ 9 MariaDB : Data Types Oracle Datatype MySQL Datatype CHAR, VARCHAR(2), NCHAR, NVARCHAR CHAR, VARCHAR, TEXT CLOB, LONG LONGTEXT RAW MEDIUMBLOB LONG RAW, BLOB BLOB BFILE None Oracle Datatype MySQL Datatype NUMBER, DECIMAL INT, BIGINT, DECIMAL NUMBER (P,S), DECIMAL (P,S) DECIMAL (P,S) REAL, DOUBLE DECIMAL FLOAT DOUBLE DATE, TIMESTAMP DATETIME,TIMESTAMP
  • 10. Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee Blog : http://ora-sysdba.tistory.com/ 10 MariaDB : Storage Engine Purpose MariaDB MySQL Memory Engine Memory Memory Based on Disk : Temp Table Engine Aria MyISAM Transaction Engine XtraDB InnoDB NOSQL Support Engine MariaDB 10.0 Over :Cassandra Memcached API (Plug-in)
  • 11. Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee Blog : http://ora-sysdba.tistory.com/ 11 MariaDB : Comparison MariaDB MySQL Thread Pool MariaDB 5.1 Over MySQL 5.5 Enterprise (Not Support Community Vesion) Buffer Pool MariaDB 5.5 Over : XtraDB MySQL 5.6 Over : InnoDB Support SSD (Solid-state Drive) MariaDB 5.5 Over : XtraDB Virtual Columns MariaDB 5.2 Over Role Management MariaDB 10.0 Over
  • 12. Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee Blog : http://ora-sysdba.tistory.com/ 12 MariaDB : Version-specific compatibility MariaDB MySQL 5.1, 5.2, 5.3 5.1 5.5, 10.0 5.5
  • 13. Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee Blog : http://ora-sysdba.tistory.com/ 13 MariaDB : Installation Step [root@sys4u ~]# groupadd -g 600 dba [root@sys4u ~]# useradd -g 600 -u 605 mysql [root@sys4u ~]# usermod -g 600 mysql [root@sys4u ~]# usermod -u 605 mysql [root@sys4u ~]# passwd mysql Changing password for user mysql. New password: Retype new password: passwd: all authentication tokens updated successfully. # vi /etc/security/limits.conf # Below the line mysql soft nproc 8192 mysql hard nproc 16384 mysql soft nofile 8192 mysql hard nofile 65536 # vi /etc/pam.d/login # Below the line session required pam_limits.so # vi /etc/profile # Below the line if [ $USER = "mysql" ]; then if [ $SHELL = "/bin/ksh" ]; then ulimit -p 16384 ulimit -n 65536 else ulimit -u 16384 -n 65536 fi
  • 14. Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee Blog : http://ora-sysdba.tistory.com/ 14 MariaDB : Installation Step [root@sys4u ~]# mkdir -p /home/mariadb [root@sys4u ~]# mkdir -p /home/data/mariadb-data [root@sys4u ~]# mkdir -p /home/data/mariadb-tmp [root@sys4u ~]# mkdir -p /home/data/mariadb-iblog [root@sys4u ~]# mkdir -p /home/data/mariadb-binlog [root@sys4u ~]# chown -R mysql:dba /home/mariadb/ [root@sys4u ~]# chown -R mysql:dba /home/data/* [root@sys4u mariadb]# ls cmake-2.8.4.tar.gz mariadb-5.5.30.tar.gz [root@sys4u mariadb]# tar -xvf cmake-2.8.4 [root@sys4u mariadb]# ls cmake-2.8.4 cmake-2.8.4.tar.gz mariadb-5.5.30.tar.gz [root@sys4u mariadb]# cd cmake-2.8.4 [root@sys4u cmake-2.8.4]# ls CMakeCPack.cmake ChangeLog.txt Source CMakeCPackOptions.cmake.in CompileFlags.cmake Templates CMakeGraphVizOptions.cmake Copyright.txt Tests CMakeLists.txt DartConfig.cmake Utilities CMakeLogo.gif DartLocal.conf.in bootstrap CTestConfig.cmake Docs cmake.1 CTestCustom.cmake.in Example cmake_uninstall.cmake.in CTestCustom.ctest.in Modules configure ChangeLog.manual Readme.txt doxygen.config [root@sys4u cmake-2.8.4]# ./bootstrap --------------------------------------------- ----- ----- --------------------------------------------- Log of errors: /home/mariadb/cmake-2.8.4/Bootstrap.cmk/cmake_bootstrap.log ---------------------------------------------
  • 15. Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee Blog : http://ora-sysdba.tistory.com/ 15 MariaDB : Installation Step [[root@sys4u cmake-2.8.4]# yum -y install gcc-c++ ----- Loaded plugins: fastestmirror, security base | 3.7 kB 00:00 base/primary_db | 4.4 MB 00:00 extras | 3.4 kB 00:00 extras/primary_db | 19 kB 00:00 updates | 3.4 kB 00:00 updates/primary_db | 3.2 MB 00:00 Setting up Install Process Resolving Dependencies --> Running transaction check ----- [root@sys4u cmake-2.8.4]# ./bootstrap ----- Makefile processor on this system is: gmake g++ is GNU compiler g++ has STL in std:: namespace g++ has ANSI streams g++ has streams in std:: namespace g++ has sstream g++ has operator!=(string, char*) g++ has stl iterator_traits g++ has standard template allocator g++ has allocator<>::rebind<> g++ does not have non-standard allocator<>::max_size argument ----- [root@sys4u cmake-2.8.4]# make ----- Scanning dependencies of target cmsys [ 1%] Building C object Source/kwsys/CMakeFiles/cmsys.dir/Terminal.o [ 2%] Building C object Source/kwsys/CMakeFiles/cmsys.dir/System.o -----
  • 16. Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee Blog : http://ora-sysdba.tistory.com/ 16 MariaDB : Installation Step [root@sys4u cmake-2.8.4]# make install ----- Install the project... -- Install configuration: "" -- Installing: /usr/local/doc/cmake-2.8/Copyright.txt -- Installing: /usr/local/share/cmake-2.8/Modules -- Installing: /usr/local/share/cmake-2.8/Modules/FindPerl.cmake -- Installing: /usr/local/share/cmake-2.8/Modules/FindLibArchive.cmake -- Installing: /usr/local/share/cmake-2.8/Modules/CMakeDetermineASMCompiler.cmake -- Installing: /usr/local/share/cmake-2.8/Modules/CMakeExportBuildSettings.cmake -- Installing: /usr/local/share/cmake-2.8/Modules/FindJPEG.cmake -----
  • 17. Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee Blog : http://ora-sysdba.tistory.com/ 17 MariaDB : Installation Step # vi /etc/my.cnf ----- #[mysqld] #datadir=/var/lib/mysql #socket=/var/lib/mysql/mysql.sock #user=mysql ## Disabling symbolic-links is recommended to prevent assorted security risks #symbolic-links=0 #[mysqld_safe] #log-error=/var/log/mysqld.log #pid-file=/var/run/mysqld/mysqld.pid [client] port = 3306 socket = /usr/local/mysql/mysql.socket [mysqld] # generic configuration options port = 3306 socket = /usr/local/mysql/mysql.socket back_log = 100 max_connections = 500 max_connect_errors = 10 table_open_cache = 2048 max_allowed_packet = 16M join_buffer_size = 8M read_buffer_size = 2M read_rnd_buffer_size = 16M sort_buffer_size = 8M thread_stack = 192K lower_case_table_names = 0 -----
  • 18. Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee Blog : http://ora-sysdba.tistory.com/ 18 MariaDB : Installation Step [root@sys4u cmake-2.8.4]# cd /home/mariadb/ [root@sys4u mariadb]# ls cmake-2.8.4 cmake-2.8.4.tar.gz mariadb-5.5.30.tar.gz [root@sys4u mariadb]# tar -xvf mariadb-5.5.30.tar.gz ----- mariadb-5.5.30/mysql-test/suite/sys_vars/r/warning_count_basic.result mariadb-5.5.30/mysql-test/suite/sys_vars/r/thread_stack_basic.result mariadb-5.5.30/mysql-test/suite/sys_vars/r/default_week_format_basic.result mariadb-5.5.30/mysql-test/suite/sys_vars/r/collation_server_basic.result mariadb-5.5.30/mysql-test/suite/sys_vars/r/shared_memory_basic.result mariadb-5.5.30/mysql-test/suite/sys_vars/r/innodb_log_group_home_dir_basic.result mariadb-5.5.30/mysql-test/suite/sys_vars/r/slave_sql_verify_checksum_basic.result mariadb-5.5.30/mysql-test/suite/sys_vars/r/innodb_merge_sort_block_size_basic.result mariadb-5.5.30/mysql-test/suite/sys_vars/r/general_log_file_func.result mariadb-5.5.30/mysql-test/suite/sys_vars/r/thread_pool_size_basic.result mariadb-5.5.30/mysql-test/suite/sys_vars/r/sync_master_info_basic.result ----- [root@sys4u mariadb-5.5.30]# /usr/local/bin/cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS=all -DMYSQL_DATADIR=/usr/local/mysql/data - DENABLED_LOCAL_INFILE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.socket ----- -- Looking for access - found -- Looking for aio_read -- Looking for aio_read - found -- Looking for alarm -- Looking for alarm - found -- Looking for backtrace -- Looking for backtrace - found -- Looking for backtrace_symbols -- Looking for backtrace_symbols - found -- Looking for backtrace_symbols_fd -----
  • 19. Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee Blog : http://ora-sysdba.tistory.com/ 19 MariaDB : Installation Step [root@sys4u mysql]# chown -R mysql:dba /usr/local/mysql* [root@sys4u mysql]# chown mysql:dba /etc/my.cnf export MYSQL_HOME=/usr/local/mysql export PATH=$PATH:$MYSQL_HOME/bin:. export ADMIN_PWD="root password” alias ll="ls -al --color=auto" alias mydba="mysql -uroot -p$ADMIN_PWD" alias mymaster="mysql -uroot -p$ADMIN_PWD -e'show master status;'" alias myslave="mysql -uroot -p$ADMIN_PWD -e'show slave statusG'" alias mh="cd $MYSQL_HOME" alias md="cd /home/data/mariadb-data" alias mt="cd /home/data/mariadb-tmp“ ----- [root@sys4u mysql]# cd /usr/local/mysql/ [root@sys4u mysql]# ./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql/ ----- WARNING: The host 'sys4u.co.kr' could not be looked up with resolveip. This probably means that your libc libraries are not 100 % compatible with this binary MariaDB version. The MariaDB daemon, mysqld, should work normally with the exception that host name resolving will not work. This means that you should use IP addresses instead of hostnames when specifying MariaDB privileges ! Installing MariaDB/MySQL system tables in '/home/data/mariadb-data' ... OK -----
  • 20. Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee Blog : http://ora-sysdba.tistory.com/ 20 MariaDB : Installation Step [root@sys4u ~]# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld cp: overwrite `/etc/init.d/mysqld'? y # /etc/init.d/mysqld 46 basedir=/home/mariadb 47 datadir=/home/data/mariadb-data [root@sys4u ~]# /usr/local/mysql/bin/mysql Welcome to the MariaDB monitor. Commands end with ; or g. Your MariaDB connection id is 2 Server version: 5.5.30-MariaDB-log Source distribution Copyright (c) 2000, 2013, Oracle, Monty Program Ab and others. Type 'help;' or 'h' for help. Type 'c' to clear the current input statement. MariaDB [(none)]>
  • 21. Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee Blog : http://ora-sysdba.tistory.com/ 21 MariaDB : Installation Step MariaDB [(none)]> use mysql Database changed MariaDB [mysql]> create database orademo; Query OK, 1 row affected (0.00 sec) MariaDB [mysql]> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | orademo | | performance_schema | | test | +--------------------+ 5 rows in set (0.00 sec) MariaDB [mysql]> grant all privileges on *.* to 'root'@'%' identified by ‘’ecsses; Query OK, 0 rows affected (0.03 sec) MariaDB [mysql]> select host, user, password from user; +-------------+------+-------------------------------------------+ | host | user | password | +-------------+------+-------------------------------------------+ | localhost | root | | | sys4u.co.kr | root | | | 127.0.0.1 | root | | | ::1 | root | | | localhost | | | | sys4u.co.kr | | | | % | root | *077D2C382FBC8EF28EFF2EF07C9BAD1595F0AB6D | +-------------+------+-------------------------------------------+ 7 rows in set (0.00 sec) MariaDB [mysql]> flush privileges; Query OK, 0 rows affected (0.00 sec)
  • 22. Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee Blog : http://ora-sysdba.tistory.com/ 22 MariaDB : MariaDB Server Startup & Shutdown [root@sys4u ~]# /etc/init.d/mysqld start Starting MySQL.... [ OK ] [root@sys4u ~]# /usr/local/mysql/bin/mysql -uroot -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or g. Your MariaDB connection id is 3 Server version: 5.5.37-tokudb-7.1.6-MariaDB-log MariaDB Server Copyright (c) 2000, 2013, Oracle, Monty Program Ab and others. Type 'help;' or 'h' for help. Type 'c' to clear the current input statement. MariaDB [(none)]> use mysql Database changed MariaDB [mysql]> exit Bye [root@sys4u ~]# /etc/init.d/mysqld stop Shutting down MySQL.. [ OK ]
  • 23. Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee Blog : http://ora-sysdba.tistory.com/ 23 MariaDB : Create DB & User MariaDB [(none)]> create database firstdb; (or create database firstdb default charcter set utf8mb4;) Query OK, 1 row affected (0.03 sec) MariaDB [(none)]> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | firstdb | | mysql | | orademo | | performance_schema | | test | +--------------------+ 6 rows in set (0.10 sec)
  • 24. Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee Blog : http://ora-sysdba.tistory.com/ 24 MariaDB : Create DB & User MariaDB [(none)]> create database firstdb; (or create database firstdb default charcter set utf8mb4;) Query OK, 1 row affected (0.03 sec) MariaDB [(none)]> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | firstdb | | mysql | | orademo | | performance_schema | | test | +--------------------+ 6 rows in set (0.10 sec)
  • 25. Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee Blog : http://ora-sysdba.tistory.com/ 25 MariaDB : Create Table MariaDB [firstdb]> create table tab_test ( -> tid bigint not null auto_increment, -> tname varchar(100) not null, -> tmeno text not null, -> primary key(tid), -> index ix_tname_tid (tname, tid) -> ) ENGINE=InnoDB; MariaDB [firstdb]> show create table tab_test; ------------+ | Table | Create Table | +----------+----------------------------------------------------------------------------------------------------- | tab_test | CREATE TABLE `tab_test` ( `tid` bigint(20) NOT NULL AUTO_INCREMENT, `tname` varchar(100) NOT NULL, `tmeno` text NOT NULL, PRIMARY KEY (`tid`), KEY `ix_tname_tid` (`tname`,`tid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 | +----------+----------------------------------------------------------------------------------------------------- ------------+ 1 row in set (0.11 sec) MariaDB [firstdb]> desc tab_test; +-------+--------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-------+--------------+------+-----+---------+----------------+ | tid | bigint(20) | NO | PRI | NULL | auto_increment | | tname | varchar(100) | NO | MUL | NULL | | | tmeno | text | NO | | NULL | | +-------+--------------+------+-----+---------+----------------+ 3 rows in set (0.00 sec)
  • 26. Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee Blog : http://ora-sysdba.tistory.com/ 26 MariaDB : Modify table (ONLINE/OFFLINE) MariaDB [firstdb]> create table t1 (fd1 int, fd2 enum('red', 'green')); Query OK, 0 rows affected (0.00 sec) MariaDB [firstdb]> alter online table t1 modify fd2 enum('red', 'green', 'blue'); Query OK, 0 rows affected (0.01 sec) Records: 0 Duplicates: 0 Warnings: 0 MariaDB [firstdb]> alter online table t1 add fd3 int; ERROR 1915 (HY000): Can't execute the given 'ALTER' command as online  Don't Need : Data Copy to Temp Table – Modify Table Names – Modify Column Names – Modify Number Type Column Length – Modify Table Comment – ENUM Type item add Online Modify Schema : MariaDB 10.0, MySQL 5.6 Over
  • 27. Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee Blog : http://ora-sysdba.tistory.com/ 27 MariaDB : Modify table (ONLINE/OFFLINE) MariaDB [firstdb]> alter table tab_test add created datetime not null; Query OK, 0 rows affected (0.30 sec) Records: 0 Duplicates: 0 Warnings: 0 MariaDB [firstdb]> alter table tab_test add index ix_created (created); Query OK, 0 rows affected (0.18 sec) Records: 0 Duplicates: 0 Warnings: 0 MariaDB [firstdb]> desc tab_test; +---------+--------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +---------+--------------+------+-----+---------+----------------+ | tid | bigint(20) | NO | PRI | NULL | auto_increment | | tname | varchar(100) | NO | MUL | NULL | | | tmeno | text | NO | | NULL | | | created | datetime | NO | MUL | NULL | | +---------+--------------+------+-----+---------+----------------+ 4 rows in set (0.00 sec)
  • 28. Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee Blog : http://ora-sysdba.tistory.com/ 28 MariaDB : DML (INSERT) MariaDB [firstdb]> create table tab_test ( -> fd1 int not null, -> fd2 varchar(50), -> primary key(fd1)) engine=innodb; Query OK, 0 rows affected (0.09 sec) MariaDB [firstdb]> insert into tab_test (fd1, fd2) values (1,'Matt'); Query OK, 1 row affected (0.06 sec) MariaDB [firstdb]> insert into tab_test values (2, 'Toto'); Query OK, 1 row affected (0.00 sec) MariaDB [firstdb]> insert into tab_test(fd1, fd2) -> values (3,'Lee') on duplicate key update fd2='Lee'; Query OK, 1 row affected (0.03 sec) MariaDB [firstdb]> insert into tab_test(fd1, fd2) -> values (3, 'SeongUck') on duplicate key update fd2='SeongUck'; Query OK, 2 rows affected (0.04 sec) MariaDB [firstdb]> select * from tab_test; +-----+----------+ | fd1 | fd2 | +-----+----------+ | 1 | Matt | | 2 | Toto | | 3 | SeongUck | +-----+----------+ 3 rows in set (0.00 sec) Option) ON DUPLICATE KEY UPDATE
  • 29. Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee Blog : http://ora-sysdba.tistory.com/ 29 MariaDB : DML (SELECT) MariaDB [firstdb]> select * from tab_test; +-----+----------+ | fd1 | fd2 | +-----+----------+ | 1 | Matt | | 2 | Toto | | 3 | SeongUck | +-----+----------+ 3 rows in set (0.00 sec) MariaDB [firstdb]> select * from tab_testG; *************************** 1. row *************************** fd1: 1 fd2: Matt *************************** 2. row *************************** fd1: 2 fd2: Toto *************************** 3. row *************************** fd1: 3 fd2: SeongUck 3 rows in set (0.00 sec)
  • 30. Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee Blog : http://ora-sysdba.tistory.com/ 30 MariaDB : DML (UPDATE) MariaDB [firstdb]> update tab_test set fd2='Brandon' where fd1=1; Query OK, 1 row affected (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 0 MariaDB [firstdb]> select * from tab_test where fd1=1; +-----+---------+ | fd1 | fd2 | +-----+---------+ | 1 | Brandon | +-----+---------+ 1 row in set (0.06 sec) MariaDB [firstdb]> select * from tab_test where fd1=1; +-----+---------+ | fd1 | fd2 | +-----+---------+ | 1 | Brandon | +-----+---------+ 1 row in set (0.06 sec) MariaDB [firstdb]> update tab_test set fd2='Brandon'; Query OK, 2 rows affected (0.03 sec) Rows matched: 3 Changed: 2 Warnings: 0 MariaDB [firstdb]> select * from tab_test; +-----+---------+ | fd1 | fd2 | +-----+---------+ | 1 | Brandon | | 2 | Brandon | | 3 | Brandon | +-----+---------+ 3 rows in set (0.01 sec) caution
  • 31. Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee Blog : http://ora-sysdba.tistory.com/ 31 MariaDB : DML (REPLACE) MariaDB [firstdb]> replace tab_test set fd1=1, fd2='Matt'; Query OK, 2 rows affected (0.00 sec) MariaDB [firstdb]> select * from tab_test where fd1=1; +-----+------+ | fd1 | fd2 | +-----+------+ | 1 | Matt | +-----+------+ 1 row in set (0.00 sec)  REPLACE <-> UPDATE – If, PK or Unique key : Recode Delete & Insert – System Over head – Recommended : INSERT INTO … ON DUPLICATE KEY UP-DATE
  • 32. Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee Blog : http://ora-sysdba.tistory.com/ 32 MariaDB : DML (DELETE) MariaDB [firstdb]> delete from tab_test where fd1=1; Query OK, 0 rows affected (0.00 sec) MariaDB [firstdb]> select * from tab_test; +-----+---------+ | fd1 | fd2 | +-----+---------+ | 2 | Brandon | | 3 | Brandon | +-----+---------+ 2 rows in set (0.00 sec) MariaDB : AUTO Commit
  • 33. Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee Blog : http://ora-sysdba.tistory.com/ 33 Reference  Presentation : Ryusuke Kajiyama (MySQL Sales Consulting Manager, JAPAC) – State of the Dolphin – MySQL for Oracle DB  Site : MariaDB Knowledge Base  Book : “Real MariaDB”
  • 34. Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee Blog : http://ora-sysdba.tistory.com/ 34 Q & A
  • 35. Copyright(c)2014 by ora-sysdba. All Page content is property of dbjongjin.lee Blog : http://ora-sysdba.tistory.com/ 35