{"id":2154,"date":"2020-06-09T03:44:21","date_gmt":"2020-06-08T19:44:21","guid":{"rendered":"https:\/\/www.wesbytes.com\/guide\/?post_type=kb&#038;p=2154"},"modified":"2026-01-12T11:30:53","modified_gmt":"2026-01-12T03:30:53","slug":"mysql-trigger-and-view","status":"publish","type":"kb","link":"https:\/\/www.servergigabit.com\/guide\/kb\/mysql-trigger-and-view","title":{"rendered":"MySQL Trigger and View"},"content":{"rendered":"<h3 dir=\"ltr\"><u><i>MySQL Trigger<\/i><\/u><\/h3>\n<p dir=\"ltr\">The MySQL trigger is a database object that is associated with a table. It will be activated when a defined action is executed for the table. The trigger can be executed when you run one of the following <a href=\"https:\/\/www.mysql.com\/\" rel=\"nofollow noopener\" target=\"_blank\">MySQL<\/a> statements on the table: INSERT, UPDATE and DELETE. It can be invoked before or after the event which means it can be schedule to run at certain time.<\/p>\n<p dir=\"ltr\"><u><i>View.<\/i><\/u><\/p>\n<p dir=\"ltr\">A view works like a table, but it is not a table. It never exists; it is only a prepared SQL statement that is run when you reference the view name.<\/p>\n<p>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++<\/p>\n<p dir=\"ltr\">MySQL creates a temporary table based on the view definition statement and then executes the incoming query on this temporary table.<\/p>\n<p dir=\"ltr\">First, MySQL combines the incoming query with the query defined the view into one query. Then, MySQL executes the combined query<\/p>\n<p dir=\"ltr\">Both of the properties above can be granted by using the \u201c<b><i>MySQL Database Wizard<\/i><\/b>\u201d in the cPanel control panel while you can also grant the privilege for the user to a specific database on Website Panel control panel as well by using the \u201cDatabase manager\u201d option. You may refer below on how to enable the trigger and view on cPanel:<\/p>\n<p dir=\"ltr\">1. Click on the \u201c<b><i>MySQL<\/i><\/b>\u201d option.<\/p>\n<p dir=\"ltr\">2. Click on the database username shown at the \u201c<b><i>Privileged Users<\/i><\/b>\u201d column.<\/p>\n<p dir=\"ltr\">3. Select the required privilege needed to be given to the database as per below.<\/p>\n<p dir=\"ltr\">4. Click on the \u201c<b><i>Make Changes<\/i><\/b>\u201d button to save the privilege assigned.<\/p>\n<p dir=\"ltr\">5. Done!<\/p>\n<p>&nbsp;<\/p>\n<p><em>Please refer to the following article to know more.\u00a0<\/em><br \/>\n<strong>Knowledge Base: <\/strong><a href=\"https:\/\/www.servergigabit.com\/guide\/kb\/how-to-change-all-mysql-database-table-collation\/\">How to change all MySQL database table collation<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>MySQL Trigger The MySQL trigger is a database object that is associated with a table. It will be activated when a defined action is executed for the table. The trigger can be executed when you run one of the following MySQL statements on the table: INSERT, UPDATE and DELETE. It can be invoked before or after the event which means&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"kbtopic":[51],"kbtag":[1215],"class_list":["post-2154","kb","type-kb","status-publish","hentry","kbtopic-mysql","kbtag-mysql"],"_links":{"self":[{"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/kb\/2154","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/kb"}],"about":[{"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/types\/kb"}],"author":[{"embeddable":true,"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/comments?post=2154"}],"version-history":[{"count":6,"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/kb\/2154\/revisions"}],"predecessor-version":[{"id":5857,"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/kb\/2154\/revisions\/5857"}],"wp:attachment":[{"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/media?parent=2154"}],"wp:term":[{"taxonomy":"kbtopic","embeddable":true,"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/kbtopic?post=2154"},{"taxonomy":"kbtag","embeddable":true,"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/kbtag?post=2154"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}