Sometimes we need to fire trigger like after delete update some fields of another tables for example if you have chatmessage tables and when remove row on this table then we need to update removecounterremovecounter 1 on users table i did give you bellow example you can see how to write t
The latest from the MySQL community
Ideas, releases, practical guides, and perspectives from the people building with MySQL.
Sometimes we need to fire trigger like after delete update some fields of another tables for example if you have chatmessage tables and when remove row on this table then we need to update removecounterremovecounter 1 on users table i did give you bellow example you can see how to write t
You may want to dump diagnostic information about the running
MySQL Database.
For MySQL 5.7, the SYS schema comes with the installation.
You can find the corresponding information on
https://dev.mysql.com/doc/refman/5.7/en/sys-diagnostics.html
For MySQL 5.6,the SYS schema can be downloaded from the following
URL https://github.com/mysql/mysql-sys
The zip file as ‘mysql-sys-master.zip’ is expanded, where the
sys_56.sql can be loaded into the MySQL 5.6 database.
# mysql -uroot -h127.0.0.1 < sys_56.sql
Using MySQL Workbench and connecting to the Server, you can find
the SYS schema installed.
Running the “diagnostics” stored procedure : …
Update: Starting with MySQL 8.0.16 we do have CHECK constraints
implemented in SQL! See here.
During our recent TechTour event the idea came up to implement
JSON document validation not necessarily via foreign keys (as I
have shown here) but to define the generated column as
NOT NULL. The generation expression must be defined in a way that
it returns NULL for invalid data.
DISCLAIMER: This has already been explored by yoku0825 in his blogpost. He deserves all
credit!
Let's do a short test:
mysql> CREATE TABLE checker (
i int,
…
It is not uncommon that we need to filter out some DBs or Tables while setting up replication. It is important to understand how MySQL evaluates/process the replication filtering rules to avoid the conflicting or confusion while we setting them up.The purpose of this blog is to illustrate the rules and provide some suggestions for best practice.
MySQL provides 3 levels of filters for setting up replication: Binary log, DB and Table. The binlog filters apply on the master to control how to log the changes. Since MySQL replication is based on the binlog, it is the first level filter and has the highest priority. While the DB-level and Table-level filters apply on the slaves, since each table belongs to a schema, the DB-level filters have higher priority than the Table-level ones. Inside the Table-level filters, MySQl will evaluate the options in the order of: …
[Read more]This is a continuing post on the Netflix architecture for Global Availability. In the past we talked about efforts like Isthmus and Active-Active. We continue the story from where we left off at the end of the Active-Active project in 2013. We had achieved multi-regional resiliency for our members in the Americas, where the vast majority of Netflix members were located at the time. Our European members, however, were still at risk from a single point of failure.Our expansion around the world since then, has resulted in a growing percentage of international members who were exposed to this single point of failure, so we set out to make our cloud deployment even more resilient.Creating a Global CloudWe decided to …
[Read more]In this blog post, we’ll discuss some of the basics regarding Docker MySQL replication. Docker has gained widespread popularity in recent years as a lightweight alternative to virtualization. It is ideal for building virtual development and testing environments. The solution is flexible and seamlessly integrates with popular CI tools.
This post walks through the setup of MySQL replication with Docker using Percona Server 5.6 images. To keep things simple we’ll configure a pair of instances and override only the most important variables for replication. You can add whatever other variables you want to override in the configuration files for each instance.
Note: the configuration described here is suitable for development or testing. We’ve also used the …
[Read more]In a previous blog post, we discussed the installation of ProxySQL and its configuration system. In today’s post, we’ll set up ProxySQL to work in a MySQL Replication environment managed by ClusterControl. We will take a look at the metrics it provides to a DBA, and how this data can be used to ensure smooth operations.
Why ProxySQL?
This is very valid question most of you are probably asking. You either already are using some kind of proxy layer (be it HAProxy or MaxScale perhaps), or you have concluded that you don’t really need a proxy layer in your setup. Why bother try and test another proxy? How can it help you …
[Read more]DNS is one of the most fundamental parts of a website. No website can run without a proper configuration on DNS. For beginners, it might be a bit difficult for them to understand and resolve DNS-related issues. This post aims to provide a bit more help for those who are still struggling to configure the DNS for their websites.
In short, what is DNS and why we need it?
DNS stands for Domain Name Service. You can think of it as a
computer responsible for converting the domain name to an IP
address. For example, if I type facebook.com into my
browser, the DNS will look into its database and return the IP
address of this domain, which is 66.220.158.68.
Because of this, most of the issues about the domain name of your
websites are related to DNS.
We need DNS because our human memory is limited and we cannot remember all complex and meaningless IP addresses of all websites in the world. It is just like …
[Read more]Overview
DDL (Data Definition Language) statements create, alter, and remove database objects. These types of changes can be a very dangerous action to take on such a critical piece of your infrastructure. You want to make sure that the command that you are executing has been given proper thought and testing.
In this post I go through multiple version of MySQL and verify the best course of action to take in regards to executing DDL statements. There are many things that you have to consider when making these types of changes, such as disk space, load on the database server, slave replication, the type of DDL statement you are executing, and if it will lock the table.
Because of these risks, there are tools that can be used to help mitigate some of the dangers. But unless you have tested and verified their functionality, these tools in themselves can cause trouble. Whenever in doubt, take the time to test …
[Read more]