Modify DEFINER on Many Views I have am having problems backing up my databases after an update.  I have been poking around on my system trying to figure out why.  One query I ran returned this result.

Got error: 1449: The user specified as a definer ('cittool'@'%') does not exist when using LOCK TABLES


After some investigation it appears that the definer for these views is an old developer account that has been purged from the system.  The databases and views with this problem are used very infrequently, and most being kept around for archival purposes.

There is about 40 views with a definer that no longer exists.  Is there an easy way to change the definer to a different account on everything at once?  Is there a way to get mysqldump to simply dump all the views out to a file so I could edit that file and recreate the views?
You can use ALTER VIEW in conjunction with the information schema. You mentioned dumping it out to a text file, so perhaps something like this:

SELECT CONCAT("ALTER DEFINER=`youruser`@`host` VIEW `",table_name,"` AS ", view_definition,";") 
FROM information_schema.views WHERE table_schema='databasename'


Mix this with the mysql command line (assuming *nix, not familiar with windows):

&gt; echo "*abovequery*" | mysql -uuser -p &gt; alterView.sql
&gt; mysql -uuser -p databasename &lt; alterView.sql


Sidenote: You can't alter the information_schema entries directly.
Note2: This works for only one database at a time, if you leave off WHERE table_schema you need to insert USE commands between each.