{"id":158,"date":"2011-10-12T11:18:51","date_gmt":"2011-10-12T16:18:51","guid":{"rendered":"http:\/\/thenoyes.com\/littlenoise\/?p=158"},"modified":"2011-10-12T11:18:51","modified_gmt":"2011-10-12T16:18:51","slug":"show-all-grants","status":"publish","type":"post","link":"https:\/\/thenoyes.com\/littlenoise\/?p=158","title":{"rendered":"Show all grants"},"content":{"rendered":"<p>A stored procedure to show all grants in the database.<\/p>\n<pre>USE mysql;\r\n\r\nDELIMITER \/\/\r\nCREATE PROCEDURE showAllGrants() BEGIN\r\n    DECLARE done INT DEFAULT 0;\r\n    DECLARE theUser CHAR(16);\r\n    DECLARE theHost CHAR(60);\r\n    DECLARE cur1 CURSOR FOR SELECT user, host FROM mysql.user;\r\n    DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1;\r\n    OPEN cur1;\r\n\r\n    REPEAT\r\n        FETCH cur1 INTO theUser, theHost;\r\n        IF NOT done THEN\r\n            SET @sql := CONCAT('SHOW GRANTS FOR ', QUOTE(theUser), '@', QUOTE(theHost));\r\n            PREPARE grantStatement FROM @sql;\r\n            EXECUTE grantStatement;\r\n            DROP PREPARE grantStatement;\r\n        END IF;\r\n    UNTIL done END REPEAT;\r\n\r\n    CLOSE cur1;\r\nEND\/\/\r\nDELIMITER ;\r\n\r\nCALL showAllGrants();<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>A stored procedure to show all grants in the database. USE mysql; DELIMITER \/\/ CREATE PROCEDURE showAllGrants() BEGIN DECLARE done INT DEFAULT 0; DECLARE theUser CHAR(16); DECLARE theHost CHAR(60); DECLARE cur1 CURSOR FOR SELECT user, host FROM mysql.user; DECLARE CONTINUE HANDLER FOR SQLSTATE &#8216;02000&#8217; SET done = 1; OPEN cur1; REPEAT FETCH cur1 INTO theUser, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[4],"tags":[],"class_list":["post-158","post","type-post","status-publish","format-standard","hentry","category-mysql"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p2IBF1-2y","jetpack_sharing_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/thenoyes.com\/littlenoise\/index.php?rest_route=\/wp\/v2\/posts\/158","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thenoyes.com\/littlenoise\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thenoyes.com\/littlenoise\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thenoyes.com\/littlenoise\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/thenoyes.com\/littlenoise\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=158"}],"version-history":[{"count":1,"href":"https:\/\/thenoyes.com\/littlenoise\/index.php?rest_route=\/wp\/v2\/posts\/158\/revisions"}],"predecessor-version":[{"id":159,"href":"https:\/\/thenoyes.com\/littlenoise\/index.php?rest_route=\/wp\/v2\/posts\/158\/revisions\/159"}],"wp:attachment":[{"href":"https:\/\/thenoyes.com\/littlenoise\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=158"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thenoyes.com\/littlenoise\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=158"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thenoyes.com\/littlenoise\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=158"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}