The sample script in this post uses the bash shell. It is also assumed that MySQL has been installed and the slave has been initialized. For MySQL 5.7 and later, the script only works for single-source replication. The server to be backed up should be configured as a slave. If you have one or more […]
MySQL Cluster
MySQL Cluster requirements to avoid Single Point of Failure
In this post, we will discuss the minimum requirements to have no single point of failure for all services in a MySQL Cluster setup. To remove all single points of failure there are the following requirements to the Cluster configuration: There must be two copies of the data To allow API and data nodes to […]
What is an Arbitrator in MySQL Cluster
If one or more nodes in a cluster fail, it is possible that not all cluster nodes will not be able to “see” one another. In fact, it is possible that two sets of nodes might become isolated from one another in a network partitioning, also known as a “split brain” scenario. This type of […]
How to set the default character set in MySQL and how to propagate it in a master-master replication scenario
In this post, we will see how to change the default character set from the default latin1_swedish_c to utf8_general_ci (or any other) and how to propagate charset changes in a master-master replication environment. 1. First determine the current default values, by issuing the MySQL command: mysql> show variables like ‘%character_set_%’; This will return something like […]
Understanding MySQL Storage Engines – MyISAM, MEMORY, BLACKHOLE and ARCHIVE
MyISAM Storage Engine MyISAM was the default MySQL storage engine prior to the MySQL server version 5.5.5. The current default is the InnoDB storage engine. The mysql database contains tables in the MyISAM format. Each MyISAM table is represented by three files: Formatfile: Stores the definition of the table structure (mytable.frm) Data file: Stores the […]
Multi-Versioning in MySQL Database
MySQL database keeps the information about old versions of changed rows and supports transactional features such as concurrency and rollback. A rollback segment is an InnoDB storage area that contains the undo log. InnoDB can respond to queries for multiple versions of the same row when those queries are part of transactions that started at […]
How to use foreign keys to attain referential integrity in MySQL
Referential Integrity Referential integrity means that relationships between tables are consistent. MySQL enforces referential integrity by using foreign key constraints. When one table (the child table) has a foreign key to another table (the parent table), MySQL prevents you from adding a record to the child table if there is no corresponding record in the […]
Beginners Guide to Storage Engines in MySQL
Storage Engines and MySQL When you create a table, MySQL uses the InnoDB storage engine to create the storage for that table on the hard disk. You can choose an alternative storage engine to use for each table. Typically, you make this choice according to which storage engine offers features that best fit the needs […]
How to obtain MySQL metadata (metadata access methods)
A database is a structured collection of data. Metadata is “data about data”. Using the following methods, MySQL provides access to metadata for databases, tables, and other objects managed by the database server: 1. INFORMATION_SCHEMA: The MySQL server contains a data dictionary implemented as a database (schema) named INFORMATION_SCHEMAthat includes a number of objects that […]
How to Restrict MySQL User Creation with Blank Password
Question: How can we not allow user creation with a blank password in MySQL? Using a blank password for a user is always a no go. In order to restrict user creation with blank password follow the steps given below: Before MySQL 5.6 In case of MySQL version below 5.6, this can not be achieved […]