no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
— | mysql_views [2012/05/22 19:56] (current) – created - external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== MySQL Views ====== | ||
+ | * [[MySQL]] | ||
+ | * [[mysqldump]] | ||
+ | |||
+ | == Display a list of the views == | ||
+ | |||
+ | < | ||
+ | SELECT table_schema, | ||
+ | </ | ||
+ | |||
+ | == Display a view creation statement == | ||
+ | |||
+ | < | ||
+ | SELECT view_definition FROM information_schema.views WHERE table_name = < | ||
+ | </ | ||
+ | |||
+ | == mysqldump notes == | ||
+ | |||
+ | When '' | ||
+ | |||
+ | When restoring the database dump, the views will be created successfully, | ||
+ | |||
+ | Trying to access the view using an SQL statement, or trying to dump the database will throw an error: | ||
+ | |||
+ | < | ||
+ | ERROR 1449 (HY000): The user specified as a definer (' | ||
+ | </ | ||
+ | |||
+ | There are a few ways to avoid this error: | ||
+ | |||
+ | - Delete the lines containing '' | ||
+ | - Create the user on the target database | ||
+ | - Modify the user to be something else | ||
+ | |||
+ | If you want to recreate the user, here's how to get the statement to insert into the '' | ||
+ | |||
+ | < | ||
+ | mysqldump --no-create-info --compact mysql --tables user -w " | ||
+ | </ |