title: mysqldump only view definitions, triggers, routines and events
body: <p>I want to be able to export these database objects into a file. It should be in such a way that running that file (later) is able to recreate the same views, triggers, functions, stored procedures and events in the original, or a different database.</p>
  
  <p>In other words, I do not want table definitions and their associated indexes and constraints.</p>
  
  <p>I had expected straightforward options for this to be available on <code>mysqldump</code>, but it doesn't seem to be the case.</p>
  
  <p>This almost does it for me:</p>
  
  <pre><code>mysqldump -u root -p source_database --no-data --no-create-db --no-create-info 
  --routines --triggers --skip-opt --set-gtid-purged=OFF &gt; db_objects.sql
  </code></pre>
  
  <p>But conspicuously missing are <code>events</code> and <code>views</code>. Also, I need to have each object DROPPED or REPLACED as the case may be, since it may already exist.</p>
  
  <p>I'd appreciate any nudge in the right direction. Perhaps I need to leverage a script to achieve this?</p>
  
  <p><strong>EDIT</strong>: Why do I need this?</p>
  
  <p>I would like to be able to run a script that recreates all these objects in one go. This could be part of maintenance of a production server, using updated counterparts from a dev server.</p>
  
  <p>Now, certain tables on the prod server might also need to be updated (ALTERED), but these are more sensitive and require a lot more thought. It is my understanding that you may drop and recreate views, events, triggers and routines 24 times a day (now I'm exaggerating!) with little concern for data conflicts.</p>