MySQL Cookbook: Difference between revisions

From Littledamien Wiki
Jump to navigation Jump to search
No edit summary
Line 15: Line 15:


To see all definers:
To see all definers:
<syntaxhighlight lang="mysql">
<syntaxhighlight lang="mysql">
SHOW PROCEDURE status;
SHOW PROCEDURE status;
</syntaxhighlight>
</syntaxhighlight>


[[Category:MySQL]]
Change definers with
[[Category:MariaDB]]
 
[[Category:Web Development]]
<syntaxhighlight lang="mysql">
UPDATE `mysql`.`proc` p SET definer = '[NEW_DEFINER]' WHERE definer='[OLD_DEFINER]';
</syntaxhighlight>
 
For example:
 
<syntaxhighlight lang="mysql">
UPDATE `mysql`.`proc` p SET definer = 'new_user@%' WHERE definer='user@%';
</syntaxhighlight>
 
 
[[Category:MySQL]] [[Category:MariaDB]] [[Category:Web Development]]

Revision as of 15:44, 15 September 2024

Create table

CREATE TABLE IF NOT EXISTS `shipping_rates` (
	`id` int(11) NOT NULL auto_increment
	, `region` varchar(50) default NULL
	, INDEX `IX_shipping_rates_region` (`region` ASC) 
	, PRIMARY KEY  (`id`)
);

See also

Change the definer of a procedure

To see all definers:

SHOW PROCEDURE status;

Change definers with

UPDATE `mysql`.`proc` p SET definer = '[NEW_DEFINER]' WHERE definer='[OLD_DEFINER]';

For example:

UPDATE `mysql`.`proc` p SET definer = 'new_user@%' WHERE definer='user@%';