SlideShare a Scribd company logo
Top 15 MySQL parameters
for beginners
Aleksandrs Asafovs
Certified Ethical Hacker(CEH)
MySQL 5 Database Administrator
Oracle Database 11g Administrator Certified Master
Oracle9i Database Administrator Certified Professional
Oracle Database 10g Administrator Certified Professional
Oracle Database 11g Administrator Certified Professional
Oracle9i Database Administrator Certified Professional - Special Accreditation:
Managing Oracle9i on Linux
Oracle RAC 11g Release 2 and Grid Infrastructure Administration
Oracle Database 10g Real Application Clusters Administrator Certified Expert
Oracle Application Server 10g Administrator Certified Associate
Oracle Weblogic Server 11g: System Administration I
About me
My name is Aleksandrs Asafovs
Working with Oracle for over 15 years
MySQL 5 years
Top 15 MySQL parameters
Certificate experts 200+
Competence
5
Data Integrity
Others
Performance schema
Security
InnoDB
Mistakes
Backup
First
parameters
6
"sorry something went
wrong"
7
• Choose the right configuration file
• Choose the right mysql option group
• [mysql] [mysqld] [mysqladmin]
"sorry something went
wrong"
8
• incorrect memory configuration server with 4Gb RAM
max_connections x (sort_buffer_size
+read_rnd_buffer_size + join_buffer_size +
read_buffer_size + thread_stack + (tmp_table_size or
max_heap_table_size)) / 4
151 x (128 MB + 256 KB + 128 MB +128 MB + 192 KB + 16 MB) / 4=15G
151 x (2 MB + 256 KB + 128KB +128 KB + 256KB  + 16 MB) / 4=708M
"sorry something went
wrong"
9
• Do not write parameters twice()
Backup
Backup
• mysqldump
• filesystem backup
• filesystem snapshot
• Percona XtraBackup(GPL license)
Backup
Purge old binary logs after this number
of days
• log_bin
•expire_logs_days
Enable binary logging. The server logs
all statements that change data to the
binary log, which is used for backup
and replication.
13
Backup
Security
14
15
skip_networking=1
bind_address=127.0.0.1
Security
Access to database
https://dev.mysql.com/doc/refman/5.6/en/server-
options.html#option_mysqld_skip-networking
16
Security
Access to database
SELECT load_file("/etc/passwd");
17
SELECT load_file("/etc/passwd");
local_infile=0
or
secure_file_priv=/tmp/
Security
Local security
Security
GRANT ALL ON test.* TO
'tomas'@'localhost';
Tomas
'tomas'@'localhost'
Test
Security
20
Security
21
Password Validation Plugin
plugin-load=validate_password.so
Security
22
Security
23
Security
Performance schema
24
Performance schema
25
Performance schema
26
Performance schema
27
Performance schema
Demo
Performance schema
• performance_schema=0(OFF) to disbale it
InnoDB
30
InnoDB
•innodb_buffer_pool_size
• innodb_log_file_size = 30 -60 minutes
innodb_log_file_size = 32 – 512M
InnoDB Undo mysql 5.7
innodb_undo_tablespaces =
innodb_undo_directory=/SSD/
https://dev.mysql.com/doc/refman/5.7/en/innodb-undo-
tablespace.html
Data Integrity
33
34
SQL_MODE
SQL_MODE
SQL_MODE
Others
37
Others
38
thread_cache_size determines the number of threads
that the server can store for reuse.
thread_cache_size efficiency
100 -((Threads_created/Connections) * 100)
Others
39
40
query_cache_size
Others Query Cache
key_buffer_size (MyISAM)
# Set to 5 - 25 %
cache mechanism to keep the most
frequently accessed table blocks in
memory:
Others
miss rate= Key_reads / Key_read_requests
=   36627/222229559 = 0.001
efficiency = 1- miss rate = 0.999
Others
[mysql]
prompt=u@h [v] [d]>_
Conclusion
https://tools.percona.com/
Choose Which Version of MySQL to Install
Thank You!
Aleksandrs Asafovs
ASAFOVS@GMAIL.COM
Q & A

More Related Content

PDF
Middleware upgrade to Oracle Fusion Middleware(FMW) 12c.Real Case stories.
PPTX
OTN Tour 2014: Rac 11g vs 12c
PDF
MySQL Performance Metrics that Matter
PDF
Intro ProxySQL
PPTX
Proxysql use case scenarios fosdem17
PDF
Upcoming changes in MySQL 5.7
PPTX
Oracle Unified Directory. Lessons learnt. Is it ready for a move from OID? (O...
PPTX
Percona Xtrabackup Best Practices
Middleware upgrade to Oracle Fusion Middleware(FMW) 12c.Real Case stories.
OTN Tour 2014: Rac 11g vs 12c
MySQL Performance Metrics that Matter
Intro ProxySQL
Proxysql use case scenarios fosdem17
Upcoming changes in MySQL 5.7
Oracle Unified Directory. Lessons learnt. Is it ready for a move from OID? (O...
Percona Xtrabackup Best Practices

What's hot (20)

PDF
MySQL NoSQL APIs
PPTX
Mysql 8 vs Mariadb 10.4 Highload++ 2019
PDF
Enterprise Drupal Application & Hosting Infrastructure Level Monitoring
PDF
AUSOUG Oracle Password Security
PDF
IaC MeetUp Active Directory Setup for Oracle Security LAB
PDF
MythBusters Globalization Support - Avoid Data Corruption
PDF
MySQL Oslayer performace optimization
PDF
MySQL 8.0.17 - New Features Summary
PDF
MySQL Server Defaults
PDF
REST in Piece - Administration of an Oracle Cluster/Database using REST
DOCX
Oracle 12c RAC On your laptop Step by Step Implementation Guide 1.0
PDF
Ohio Linux Fest -- MySQL's NoSQL
PDF
Upgrade to MySQL 5.6 without downtime
PDF
My sql 56_roadmap_april2012
PDF
MySQL 5.7 milestone
PDF
An introduction into Oracle VM V3.x
PDF
MySQL Webinar 2/4 Performance tuning, hardware, optimisation
PDF
MySQL 8.0.21 - New Features Summary
PDF
Plny12 galera-cluster-best-practices
PDF
MySQL 8.0.18 - New Features Summary
MySQL NoSQL APIs
Mysql 8 vs Mariadb 10.4 Highload++ 2019
Enterprise Drupal Application & Hosting Infrastructure Level Monitoring
AUSOUG Oracle Password Security
IaC MeetUp Active Directory Setup for Oracle Security LAB
MythBusters Globalization Support - Avoid Data Corruption
MySQL Oslayer performace optimization
MySQL 8.0.17 - New Features Summary
MySQL Server Defaults
REST in Piece - Administration of an Oracle Cluster/Database using REST
Oracle 12c RAC On your laptop Step by Step Implementation Guide 1.0
Ohio Linux Fest -- MySQL's NoSQL
Upgrade to MySQL 5.6 without downtime
My sql 56_roadmap_april2012
MySQL 5.7 milestone
An introduction into Oracle VM V3.x
MySQL Webinar 2/4 Performance tuning, hardware, optimisation
MySQL 8.0.21 - New Features Summary
Plny12 galera-cluster-best-practices
MySQL 8.0.18 - New Features Summary
Ad

Viewers also liked (20)

PPTX
What are the important brand architecture decisions in developing a branding ...
DOC
Manifiesto ciudadano
PPS
Estadios para el 2014
PDF
Creative Commons: Not Just For Nerds
PDF
Catálogo BEEP Complementos 2014
DOCX
Evaluacion de geometrtia.
PDF
Padrões de deploy para DevOps e Entrega Contínua, por Danilo Sato
PPTX
Philosophy of history
PPTX
Jabones de avena
PDF
Android discovery and verification of neighbor positions in mobile ad hoc ne...
PPTX
General election 2014 : Social Media campaigning on Facebook
PDF
Java EE7: Developing for the Cloud
PDF
Article hotellerie
DOCX
Faltas al reglamento DE TRANSITO DE VER.
PDF
LeadMe 경험글 작성 가이드
PDF
Enano newsletter issue20-21
PDF
bob lovett1
PDF
Skipsea Sands Support Visit 2009
PDF
A locandin abrusson2011totale[1](2)
PDF
Nano Companies in Spain
What are the important brand architecture decisions in developing a branding ...
Manifiesto ciudadano
Estadios para el 2014
Creative Commons: Not Just For Nerds
Catálogo BEEP Complementos 2014
Evaluacion de geometrtia.
Padrões de deploy para DevOps e Entrega Contínua, por Danilo Sato
Philosophy of history
Jabones de avena
Android discovery and verification of neighbor positions in mobile ad hoc ne...
General election 2014 : Social Media campaigning on Facebook
Java EE7: Developing for the Cloud
Article hotellerie
Faltas al reglamento DE TRANSITO DE VER.
LeadMe 경험글 작성 가이드
Enano newsletter issue20-21
bob lovett1
Skipsea Sands Support Visit 2009
A locandin abrusson2011totale[1](2)
Nano Companies in Spain
Ad

Similar to Top 15 MySQL parameters (20)

PDF
在Oel5上安装配置oracle gird control 10.2.0.5
ODP
Caching and tuning fun for high scalability
PPT
EM12C High Availability without SLB and RAC
PDF
MySQL Utilities -- PyTexas 2015
PPTX
Best And Worst Practices Deploying IBM Connections
PPT
MySQL Performance Tuning at COSCUP 2014
PDF
Data Guard Deep Dive UKOUG 2012
PDF
제3회난공불락 오픈소스 인프라세미나 - MySQL
PDF
Enterprise manager cloud control 12c(12.1) &agent安装图文指南
ODP
Caching and tuning fun for high scalability
PPT
My two cents about Mysql backup
ODP
Nagios Conference 2012 - Dan Wittenberg - Case Study: Scaling Nagios Core at ...
DOCX
PPTX
MySQL Tech Tour 2015 - 5.7 Whats new
PDF
Running MySQL on Linux
PPTX
Improving Website Performance with Memecached Webinar | Achieve Internet
PPTX
Improving Website Performance with Memecached Webinar | Achieve Internet
PDF
1049: Best and Worst Practices for Deploying IBM Connections - IBM Connect 2016
PDF
MySQL 5.7: What's New, Nov. 2015
KEY
Grabbing the PostgreSQL Elephant by the Trunk
在Oel5上安装配置oracle gird control 10.2.0.5
Caching and tuning fun for high scalability
EM12C High Availability without SLB and RAC
MySQL Utilities -- PyTexas 2015
Best And Worst Practices Deploying IBM Connections
MySQL Performance Tuning at COSCUP 2014
Data Guard Deep Dive UKOUG 2012
제3회난공불락 오픈소스 인프라세미나 - MySQL
Enterprise manager cloud control 12c(12.1) &agent安装图文指南
Caching and tuning fun for high scalability
My two cents about Mysql backup
Nagios Conference 2012 - Dan Wittenberg - Case Study: Scaling Nagios Core at ...
MySQL Tech Tour 2015 - 5.7 Whats new
Running MySQL on Linux
Improving Website Performance with Memecached Webinar | Achieve Internet
Improving Website Performance with Memecached Webinar | Achieve Internet
1049: Best and Worst Practices for Deploying IBM Connections - IBM Connect 2016
MySQL 5.7: What's New, Nov. 2015
Grabbing the PostgreSQL Elephant by the Trunk

More from Andrejs Vorobjovs (20)

PDF
Peteris Arajs - Where is my data
PPTX
Maksims Greckis - Trace File Analyzer
PDF
Aleksejs Nemirovskis - Manage your data using oracle BDA
PPTX
LVOUG meetup #18
PPTX
LVOUG meetup #17
PPTX
LVOUG meetup #16
PDF
Riga Dev Day vestule
PDF
Rdd2016 featured talks
PDF
Rdd2016 flyer
PDF
meetup #15
PDF
OTN tour 2015 press release in Russian
PPTX
OTN tour 2015, 100miles
PDF
OTN tour 2015 benchmarking oracle io performance with Orion by Alex Gorbachev
PPTX
OTN tour 2015 Oracle Enterprise Manager 12c – Proof of Concept
PDF
OTN tour Oracle db Cloud by Alex Gorbachev
PDF
OTN tour 2015 Experience in implementing SSL between oracle db and oracle cli...
PDF
OTN tour 2015 AWR data mining
PDF
OTN tour 2015 opening speech
PDF
OTN tour 2015 agenda Alex Gorbachev and Yury Velikanov
PPTX
LVOUG news 5-OCT-2015
Peteris Arajs - Where is my data
Maksims Greckis - Trace File Analyzer
Aleksejs Nemirovskis - Manage your data using oracle BDA
LVOUG meetup #18
LVOUG meetup #17
LVOUG meetup #16
Riga Dev Day vestule
Rdd2016 featured talks
Rdd2016 flyer
meetup #15
OTN tour 2015 press release in Russian
OTN tour 2015, 100miles
OTN tour 2015 benchmarking oracle io performance with Orion by Alex Gorbachev
OTN tour 2015 Oracle Enterprise Manager 12c – Proof of Concept
OTN tour Oracle db Cloud by Alex Gorbachev
OTN tour 2015 Experience in implementing SSL between oracle db and oracle cli...
OTN tour 2015 AWR data mining
OTN tour 2015 opening speech
OTN tour 2015 agenda Alex Gorbachev and Yury Velikanov
LVOUG news 5-OCT-2015

Recently uploaded (20)

PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PPTX
GDM (1) (1).pptx small presentation for students
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PPTX
master seminar digital applications in india
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
Complications of Minimal Access Surgery at WLH
PDF
Anesthesia in Laparoscopic Surgery in India
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PDF
TR - Agricultural Crops Production NC III.pdf
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PDF
RMMM.pdf make it easy to upload and study
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PPTX
Pharma ospi slides which help in ospi learning
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
Sports Quiz easy sports quiz sports quiz
PPTX
Lesson notes of climatology university.
Module 4: Burden of Disease Tutorial Slides S2 2025
GDM (1) (1).pptx small presentation for students
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
master seminar digital applications in india
2.FourierTransform-ShortQuestionswithAnswers.pdf
Complications of Minimal Access Surgery at WLH
Anesthesia in Laparoscopic Surgery in India
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
TR - Agricultural Crops Production NC III.pdf
Renaissance Architecture: A Journey from Faith to Humanism
RMMM.pdf make it easy to upload and study
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
Pharma ospi slides which help in ospi learning
Abdominal Access Techniques with Prof. Dr. R K Mishra
Sports Quiz easy sports quiz sports quiz
Lesson notes of climatology university.

Top 15 MySQL parameters

Editor's Notes

  • #9: sort_buffer_size The default is 2 MB and can be considered large for OLTP applications. Change this system variable to 128 KB and increase as necessary. When a query exceeds the available memory assigned in this buffer, a disk-based sort (disk seek) is used. read_rnd_buffer_size The default is 256 KB and should be kept at this setting for most servers. Experiment with changing this system variable value only if you see a lot of rows being sorted. join_buffer_size The default is 128 KB. Any increase in the size of this buffer can cause negative system performance. Queries that use this setting uses the entire buffer size even if they do not require it. read_buffer_size The default is 128 KB and should be set in increments of 4 KB. When queries perform writes, either through a SELECT INTO ... OUTFILE query or when merged results (when filesort is used) are written to a temporary file, this setting is used for buffering the output. There is no fixed formula for setting this variable. But with all variables, benchmarking different values is essential to obtaining the best value that should be used. tmp_table_size When the MySQL server creates temporary tables to handle a query execution, the size of the internal memory tables that can be stored is determined by this setting. If the in-memory temporary table exceeds the available memory assigned by this buffer, an on-disk MyISAM table is created. Excludes those tables that you create with CREATE TABLE ... ENGINE=MEMORY. When setting the value of this variable, the following status variables can be of assistance: Created_tmp_disk_tables displays the number of on-disk temporary tables that were created to handle query executions. Created_tmp_tables displays the total number of temporary tables that were created to handle query executions Note: You can compare the number of internal on-disk temporary tables created to the total number of internal temporary tables created by comparing the values of the Created_tmp_disk_tables and Created_tmp_tables variables. You should consider that each invocation of the SHOW STATUS statement uses an internal temporary table and increments the global Created_tmp_tables value. thread_stack The default is dependent on the O/S and the number of bits supported. Reducing the size of this system variable can have the following effects: The complexity of SQL statements that the server can handle is limited (could result in a thread stack overrun error). Recursion depth of stored procedures along with other memory-consuming actions is also limited.
  • #17: File privileges
  • #25: The Performance Schema is a system database which makes it easy to gather performance metrics and query them by using SQL. The data is stored in temporary tables and views, with little or no persistent disk storage. The schema contains many tables and you can use a helper tool such as the MySQL sys schema which is covered later in this lesson, to make the Performance Schema easier to query. Performance Schema is enabled by default, and incurs a minimal performance overhead. To view the amount of resources Performance Schema is using, execute the following command: mysql> SHOW ENGINE performance_schema STATUS; ... | performance_schema | performance_schema.memory | 1285885728 | 155 rows in set (0.00 sec) You can reduce the overhead of Performance Schema by disabling unwanted monitoring. On a busy production server without any performance issues you might want to prevent Performance Schema from performing any tasks. To do this, disable the global_instrumentation consumer. To disable Performance Schema entirely, set the global variable performance_schema to OFF, and then restart the MySQL server. Each of the configuration items listed in the slide corresponds to a table within the performance_schema database. You change the contents of these tables to affect what is monitored, and how it is monitored.
  • #29: Open virtuoso,open obamo
  • #32: SELECT VARIABLE_VALUE INTO @baseline FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'INNODB_OS_LOG_WRITTEN'; SELECT SLEEP(60 * 60); SELECT VARIABLE_VALUE INTO @afteronehour FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'INNODB_OS_LOG_WRITTEN'; SET @BytesWrittenToLog = @afteronehour - @baseline; SELECT @BytesWrittenToLog / POWER(1024,2) AS MB_PER_HR;
  • #39: he thread cache has a size determined by the thread_cache_size system variable. The default value is 0 (no caching), which causes a thread to be set up for each new connection and disposed of when the connection terminates. Setthread_cache_size to N to enable N inactive connection threads to be cached. thread_cache_size can be set at server startup or changed while the server runs. A connection thread becomes inactive when the client connection with which it was associated terminates. To monitor the number of threads in the cache and how many threads have been created because a thread could not be taken from the cache, monitor the Threads_cached and Threads_created status variables. You can set max_connections at server startup or at runtime to control the maximum number of clients that can connect simultaneously. When the thread stack is too small, this limits the complexity of the SQL statements which the server can handle, the recursion depth of stored procedures, and other memory-consuming actions. To set a stack size of N bytes for each thread, start the server with --thread_stack=N. The Connections status variable lists the number of connection attempts (successful or not) to the MySQL server. The Threads_created status variable lists the number of threads created to handle connections.
  • #40: he thread cache has a size determined by the thread_cache_size system variable. The default value is 0 (no caching), which causes a thread to be set up for each new connection and disposed of when the connection terminates. Setthread_cache_size to N to enable N inactive connection threads to be cached. thread_cache_size can be set at server startup or changed while the server runs. A connection thread becomes inactive when the client connection with which it was associated terminates. To monitor the number of threads in the cache and how many threads have been created because a thread could not be taken from the cache, monitor the Threads_cached and Threads_created status variables. You can set max_connections at server startup or at runtime to control the maximum number of clients that can connect simultaneously. When the thread stack is too small, this limits the complexity of the SQL statements which the server can handle, the recursion depth of stored procedures, and other memory-consuming actions. To set a stack size of N bytes for each thread, start the server with --thread_stack=N. The Connections status variable lists the number of connection attempts (successful or not) to the MySQL server. The Threads_created status variable lists the number of threads created to handle connections.