Showing posts with label MariaDB. Show all posts
Showing posts with label MariaDB. Show all posts

June 4, 2023

50 Essential MySQL/MariaDB DBA interview questions answers

MySQL/MariaDB DBA Interview Questions and Answers - Part 3


Q41. How do you monitor and identify slow queries in MySQL?
answer:
You can enable the slow query log in MySQL and set a threshold for query execution time using the long_query_time variable. Slow queries exceeding the threshold will be logged, allowing you to analyze and optimize them.

Q42. How do you enable slow query logging in MySQL?
answer:
To enable slow query logging, you need to set the slow_query_log variable to ON and configure the long_query_time variable to specify the threshold for query execution time.

Q43. How do you enable query caching in MySQL?
answer:
To enable query caching, you need to set the query_cache_type variable to a non-zero value (e.g., ON), and configure the query_cache_size variable to allocate memory for caching query results.

Q44. How do you import data from a CSV file into a MySQL table?
answer:
You can use the LOAD DATA INFILE statement to import data from a CSV file into a MySQL table. The statement allows you to specify the file path, field delimiters, and column mappings.

Q45. What is the purpose of the EXPLAIN statement in MySQL?
answer:
The EXPLAIN statement is used to analyze and optimize the execution plan of a query. It provides information about how MySQL executes a query, the order of table access, the indexes used, and estimated row counts.

Q46. What is the difference between MyISAM and InnoDB?
answer:
MyISAM is a non-transactional storage engine with high read performance and is suitable for read-heavy workloads. InnoDB is a transactional storage engine with support for ACID (Atomicity, Consistency, Isolation, Durability) properties, providing better data integrity and concurrency control.

Q47. How do you perform point-in-time recovery in MySQL?
answer:
To perform point-in-time recovery, you need to restore a backup taken before the desired point in time and then apply binary logs containing changes made after the backup. This process brings the database to a specific state as of the desired point in time.

Q48. What is the purpose of the --skip-lock-tables option in mysqldump?
answer:
The --skip-lock-tables option in mysqldump allows you to perform a logical backup of the database without acquiring read locks on the tables. It enables you to backup a database while it is still being actively used, avoiding interruptions.

Q49. What is the purpose of the REPAIR TABLE statement in MySQL?
answer:
The REPAIR TABLE statement is used to repair corrupted or damaged MyISAM tables. It automatically detects and fixes common table issues, such as incorrect links, missing rows, or index problems.

Q50. What is the purpose of the mysqlbinlog utility?
answer:
The mysqlbinlog utility is used to read and display the contents of binary log files. It allows you to view the logged changes, including SQL statements and events, facilitating analysis, troubleshooting, and replication tasks.

Related MySQL Articles:  Best MySQL DBA Interview Questions and Answers Part 1   MySQL DBA Basic/Advanced Interview Questions - Part 2

March 7, 2023

Best 50 MySQL DBA interview questions answers

MySQL/MariaDB DBA Interview Questions and Answers - Part 2


Q21. How a Galera cluster works?
answer:

Q22. What are the different types of replication in MySQL?
answer:
MySQL supports various replication topologies, including master-slave replication, master-master replication, and group replication. Each has its own benefits and use cases.

Q23. What is the purpose of the binary log in MySQL?
answer:
The binary log contains a record of all changes made to the MySQL database. It is used for various purposes, including replication, point-in-time recovery, and auditing.

Q24. How does MySQL Group Replication (GR) work?
answer:

Q25. What is the between MySQL Group Replication and Galera Cluster and Percona XtraDB Cluster?
answer: 

Q26. How to setup MySQL replication from AWS MySQL RDS to Amazon Aurora MySQL?
answer:

Q27. What are the advantages of the Percona XtraDB Cluster (PXC)?
answer:

Q28. What is the use of ProxySQL/HAProxy?
answer:

Q29. How to use the Percona tool kit and what utilities do you know in Percona tool kit?
answer:

Q30. What is the difference between IST (Incremental State Transfer) and SST (Snapshot State Transfer) in PXC (Percona XtraDB Cluster)?
answer:

Q31.  How do you restore a MySQL database from a backup?
answer: 
To restore a MySQL database from a backup, you can use the MySQL command-line client or a graphical tool like phpMyAdmin. The process typically involves creating an empty database, importing the backup file, and ensuring data consistency.

Q32. What are the efficient ways to do (online) schema changes?
answer:

Q33. What is the best way to do DDL changes without locking the table?
answer:

Q34. What are the different storage engines supported by MySQL?
answer: 
MySQL supports various storage engines, including InnoDB, MyISAM, MEMORY, CSV, ARCHIVE, and more. InnoDB is the default storage engine from MySQL version 5.5 onwards.

Q35. What is the purpose of the InnoDB storage engine?
answer: 
InnoDB is designed for high-performance and reliability, offering features such as transactions, row-level locking, foreign key constraints, and crash recovery.

Q36. How do you monitor the performance of a MySQL server?
answer: 
You can monitor a MySQL server using various tools, including MySQL Enterprise Monitor, Performance Schema, EXPLAIN statement, slow query logs, and third-party monitoring solutions.

Q37. What is a deadlock in MySQL?
answer: 
A deadlock occurs when two or more transactions wait indefinitely for each other to release resources, resulting in a state where none of the transactions can proceed. MySQL automatically detects and resolves deadlocks by rolling back one of the involved transactions.

Q38. What is the purpose of the ANALYZE TABLE statement?
answer: 
The ANALYZE TABLE statement is used to analyze and update index statistics for a table. It helps the MySQL optimizer make better decisions when creating query execution plans.

Q39. How do you secure a MySQL server? what are the best practices for securing a MySQL database?
answer: 
  • Using strong passwords and avoiding default or easily guessable usernames.
  • Limiting network access to the database server.
  • Regularly applying security patches and updates.
  • Using SSL/TLS for encrypted connections.
  • Implementing firewall rules to restrict access.
  • Applying the principle of least privilege.

Q40. What is the purpose of the mysqlcheck utility?
answer: 
The mysqlcheck utility is used to check, repair, optimize, and analyze MySQL tables. It performs maintenance tasks to ensure data integrity and improve performance.


Related MySQL Articles:  Top MySQL DBA Basic/advanced Interview Questions and Answers Part 1

August 4, 2022

Top 50 MySQL DBA interview questions answers

MySQL/MariaDB DBA Interview Questions and Answers - Part 1


Q1. What is the MySQL default port number?
answer: 3306

Q2. How MySQL replication works?
answer:
Replication is the process of creating and maintaining multiple copies of a MySQL database. It allows you to synchronize data across multiple database servers, providing high availability, scalability, and redundancy.

Q3. How will you fix MySQL slave replication issues?
answer:

Q4. What is GTID based replication?
answer:

Q5. Please explain the main differences between RDS MySQL and Amazon Aurora MySQL cluster?
answer:

Q6. Define ACID properties?
answer:

Q7. How many types of backups are available in MySQL? How do you take a backup of a MySQL database?
answer:
MySQL provides multiple methods for backup, such as using the mysqldump utility, using the MySQL Enterprise Backup tool, or performing raw data backups using file system-level tools.

Q8. How do you take incremental backup in MySQL?
answer: 

Q9. Give the different types of logs available in MySQL?
answer:

Q10. What is the command to retrieve the current date in MySQL?
answer:

Q11. Which is the default database engine utilized in MySQL?
answer:

Q12. Provide the various database engines present in MySQL?
answer:

Q13. How can a user get the current MySQL version?
answer:

Q14. What is Sharding in MySQL?
answer:

Q15. Is there any way to optimize MySQL tables? What is optimize table command do?
answer:

Q16. What are the Transaction Isolation Levels in MySQL database?
answer:

Q17. What is the default Transaction Isolation Level in MySQL?
answer:

Q18. How to change Transaction Isolation Level in MySQL?
answer:

Q19. What is MVCC in MySQL database?
answer:

Q20. How to improve the performance of a MySQL query?
answer:

    
Related MySQL Articles: 50 
Best MySQL DBA interview questions answers Part 2   MySQL Database Administrator Online Quiz

February 20, 2022

MariaDB MariaBackup commands

MariaBackup MariaDB commands


MariaBackup is a backup utility for MariaDB.
MariaDB backup and recovery using Mariabackup.
Full backup and incremental backups using Mariabackup and Mariabackup commands options.

mariabackup --backup --data-dir=/data/mariadb/ --target-dir=/data/backups
mariabackup --backup --target-dir=/data/backups --user=mariabackup --password=secret
mariabackup --backup --data-dir=/data/mariadb/ --target-dir=/data/backups --user=mariabackup --password=secret
mariabackup --binlog-info --backup
mariabackup --compress --backup
mariabackup --backup --compress --compress-threads=12 --compress-chunk-size=5M
mariabackup --compress --compress-threads=12 --backup
mariabackup --core-file --backup
mariabackup --backup --databases="example.table1 example.table2"
mariabackup --backup --databases="example" --databases-exclude="example.table1 example.table2"
mariabackup --backup --databases-file=main-backup
mariabackup --backup -h /var/lib64/mysql
mariabackup --backup --defaults-file-extra=addition-config.cnf --defaults-file=config.cnf
mariabackup --backup --defaults-file="config.cnf
mariabackup --backup --target-dir=/home/mysql/inc1/ --incremental-basedir=/home/mysql/backup/ --user=mariabackup --password=mypassword
mariabackup --backup --target-dir=/tmp/mariadb/backup/increment/ --incremental-basedir=/tmp/mariadb/backup/ --user=backupuser --password=backup123

mariabackup --prepare --target-dir=/mariadb/backup/
mariabackup --prepare --data-dir=/data/mysql/ --target-dir=/data/backups
mariabackup --prepare --data-dir=/data/mysql/ --target-dir=/data/backups --user=mariabackup --password=secret
mariabackup --prepare --target-dir=/home/mariadb/backup --incremental-dir=/home/mariadb/inc1
mariabackup --prepare --apply-log-only --target-dir=/tmp/mariadb/backup/
mariabackup --prepare --apply-log-only --target-dir=/tmp/mariadb/backup/ --incremental-dir=/tmp/mariadb/backup/increment/
mariabackup --close-files --prepare
mariabackup --prepare --apply-log-only --target-dir=/tmp/mariadb/backup/ --incremental-dir=/tmp/mariadb/backup/incrementNew/
mariabackup --innobackupex --apply-log

mariabackup --copy-back --target-dir=/mariadb/backup/
mariabackup --copy-back --data-dir=/data/mysql/ --target-dir=/data/backups
mariabackup --copy-back --force-non-empty-directories
mariabackup --move-back --target-dir=/var/mariadb/backup/


Related Articles: Percona Xtrabackup 
(full/incremental) Backup & Recovery