Answers.Body: <p>You're on the right track--when you see a MySQL error and you can't see what's wrong with it, try it out manually.  It seemed like a permission problem on the face of it, and the error you got was a lack of permissions.
  I think the wiki just threw you off with how it is written.  It does say,</p>
  
  <blockquote>
    <p>Also, to enable CiviCase you should set CREATE VIEW permission.</p>
  </blockquote>
  
  <p>That's just in this aside just before the main list.</p>
  
  <p>Now, if you don't use CiviCase, you still might try granting that permission and trying it out--I wouldn't put it past someone to change Civi without updating the wiki! Many of us would never notice--I typically give that permission to the DB user as part of a standard setup, and I bet many others do too.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-05-28T11:48:08.900Z
Answers.LastActivityDate: 2015-05-28T11:48:08.900Z
Answers.UserDisplayName: Andie Hunt
Answers.Body: <p>Thank you, Andrew.</p>
  
  <p>To add this permission to the DB in question, I logged in with the master MySQL account and issued:</p>
  
  <pre><code>mysql&gt; GRANT CREATE VIEW ON d1_civicrm.* TO 'ud1_civicrm'@'localhost';
  mysql&gt; GRANT CREATE VIEW ON d1_civicrm.* TO 'ud1_civicrm'@'127.0.0.1';
  mysql&gt; FLUSH PRIVILEGES;
  </code></pre>
  
  <p>Then went back to PHPMyAdmin, logged in as ud1_civicrm, and successfully was able to execute:</p>
  
  <pre><code>CREATE OR REPLACE VIEW civicrm_domain_view AS SELECT * FROM civicrm_domain
  </code></pre>
  
  <p>and</p>
  
  <pre><code>SELECT *
  FROM civicrm_domain_view;
  </code></pre>
  
  <p>At least in the latest (4.6.3) CiviCRM powered with Drupal 6 there is no separate "enable/disable" of CiviCase. It must be always enabled, thus this must be always a permission required. No?</p>
  
  <p>I will similarly update the other CiviCRM instances I administer before applying the 4.6.3 update. I am relieved I did NOT have to rebuild the CiviCRM database this time to correct the error!</p>
  
  <p>I am thankful,</p>
  
  <p>Michael</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-05-28T23:50:15.330Z
Answers.LastActivityDate: 2015-05-28T23:50:15.330Z
Answers.UserDisplayName: Michael Lueck
Body: <p>The last CiviCRM upgrade I was running, I received a couple of the same DB errors. Sanitized, minimally, the error was as follows:</p>
  
  <pre><code>#7 /srv/www/sites/d1.orgname.org/www/sites/all/modules/civicrm/packages/DB/mysqli.php(403): DB_mysqli-&gt;mysqliRaiseError()
  #8 /srv/www/sites/d1.orgname.org/www/sites/all/modules/civicrm/packages/DB/common.php(1216): DB_mysqli-&gt;simpleQuery("CREATE OR REPLACE VIEW civicrm_domain_view AS SELECT * FROM civicrm_domain")
  </code></pre>
  
  <p>Does that mean that CiviCRM has lost some of its MySQL DB permissions and I must rebuild the DB (<a href="http://wiki.civicrm.org/confluence/display/CRMDOC/Ensuring+Schema+Integrity+on+Upgrades" rel="nofollow">according to these instructions</a>) ?</p>
  
  <p>I went looking for where in the CiviCRM source code that view is mentioned, and found:</p>
  
  <pre><code>$ grep -r civicrm_domain_view *
  CRM/Core/DAO.php:      $dao-&gt;query('CREATE OR REPLACE VIEW civicrm_domain_view AS SELECT * FROM civicrm_domain');
  CRM/Core/DAO.php:          $dao-&gt;query('DROP VIEW IF EXISTS civicrm_domain_view');
  CRM/Core/DAO.php:          $dao-&gt;query('DROP VIEW IF EXISTS civicrm_domain_view');
  CRM/Core/DAO.php:      $dao-&gt;query('DROP VIEW IF EXISTS civicrm_domain_view');
  </code></pre>
  
  <p>I tried running this via PHPMyAdmin:</p>
  
  <pre><code>SELECT *
  FROM civicrm_domain_view;
  </code></pre>
  
  <p>And receive an error that the view does not exist.
  "#1146 - Table 'd1_civicrm.civicrm_domain_view' doesn't exist"</p>
  
  <p>Next I tried executing:</p>
  
  <pre><code>CREATE OR REPLACE VIEW civicrm_domain_view AS SELECT * FROM civicrm_domain
  </code></pre>
  
  <p>which told me the MySQL ID did not have permissions to create the view.</p>
  
  <p>So I checked, what do you know that was not a permission I granted to the CiviCRM ID. I provisioned the MySQL account according to <a href="http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+MySQL+Permission+Requirements" rel="nofollow">these instructions</a>. They do not state that the Create_view_priv perm is required, if this is even the correct perm. (I just saw the word "view" and looked there first.)</p>
  
  <p>Suggestions?</p>
  
  <p>I am thankful,</p>
  
  <p>Michael</p>
  
Tags: <drupal><mysql>
Title: Does this view error mean CiviCRM has lost some MySQL DB perms?
ThreadText: # Does this view error mean CiviCRM has lost some MySQL DB perms?
  
  (Asked by: username_0 on 2015-05-28)
  
  The last CiviCRM upgrade I was running, I received a couple of the same DB errors. Sanitized, minimally, the error was as follows:
  
  ```
  #7 /srv/www/sites/d1.orgname.org/www/sites/all/modules/civicrm/packages/DB/mysqli.php(403): DB_mysqli->mysqliRaiseError()
  #8 /srv/www/sites/d1.orgname.org/www/sites/all/modules/civicrm/packages/DB/common.php(1216): DB_mysqli->simpleQuery("CREATE OR REPLACE VIEW civicrm_domain_view AS SELECT * FROM civicrm_domain")
  
  ```
  
  Does that mean that CiviCRM has lost some of its MySQL DB permissions and I must rebuild the DB ([according to these instructions](http://wiki.civicrm.org/confluence/display/CRMDOC/Ensuring+Schema+Integrity+on+Upgrades)) ?
  
  I went looking for where in the CiviCRM source code that view is mentioned, and found:
  
  ```
  $ grep -r civicrm_domain_view *
  CRM/Core/DAO.php:      $dao->query('CREATE OR REPLACE VIEW civicrm_domain_view AS SELECT * FROM civicrm_domain');
  CRM/Core/DAO.php:          $dao->query('DROP VIEW IF EXISTS civicrm_domain_view');
  CRM/Core/DAO.php:          $dao->query('DROP VIEW IF EXISTS civicrm_domain_view');
  CRM/Core/DAO.php:      $dao->query('DROP VIEW IF EXISTS civicrm_domain_view');
  
  ```
  
  I tried running this via PHPMyAdmin:
  
  ```
  SELECT *
  FROM civicrm_domain_view;
  
  ```
  
  And receive an error that the view does not exist.
  "#1146 - Table 'd1\_civicrm.civicrm\_domain\_view' doesn't exist"
  
  Next I tried executing:
  
  ```
  CREATE OR REPLACE VIEW civicrm_domain_view AS SELECT * FROM civicrm_domain
  
  ```
  
  which told me the MySQL ID did not have permissions to create the view.
  
  So I checked, what do you know that was not a permission I granted to the CiviCRM ID. I provisioned the MySQL account according to [these instructions](http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+MySQL+Permission+Requirements). They do not state that the Create\_view\_priv perm is required, if this is even the correct perm. (I just saw the word "view" and looked there first.)
  
  Suggestions?
  
  I am thankful,
  
  username_0
  
  **Tags:** drupal, mysql
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2015-05-28. Score: 2 | Accepted answer
  
  You're on the right track--when you see a MySQL error and you can't see what's wrong with it, try it out manually. It seemed like a permission problem on the face of it, and the error you got was a lack of permissions.
  I think the wiki just threw you off with how it is written. It does say,
  
  > Also, to enable CiviCase you should set CREATE VIEW permission.
  
  That's just in this aside just before the main list.
  
  Now, if you don't use CiviCase, you still might try granting that permission and trying it out--I wouldn't put it past someone to change Civi without updating the wiki! Many of us would never notice--I typically give that permission to the DB user as part of a standard setup, and I bet many others do too.
  
  
  ---
  
  ### Answer by username_0 on 2015-05-28. Score: 0
  
  Thank you, Andrew.
  
  To add this permission to the DB in question, I logged in with the master MySQL account and issued:
  
  ```
  mysql> GRANT CREATE VIEW ON d1_civicrm.* TO 'ud1_civicrm'@'localhost';
  mysql> GRANT CREATE VIEW ON d1_civicrm.* TO 'ud1_civicrm'@'127.0.0.1';
  mysql> FLUSH PRIVILEGES;
  
  ```
  
  Then went back to PHPMyAdmin, logged in as ud1\_civicrm, and successfully was able to execute:
  
  ```
  CREATE OR REPLACE VIEW civicrm_domain_view AS SELECT * FROM civicrm_domain
  
  ```
  
  and
  
  ```
  SELECT *
  FROM civicrm_domain_view;
  
  ```
  
  At least in the latest (4.6.3) CiviCRM powered with Drupal 6 there is no separate "enable/disable" of CiviCase. It must be always enabled, thus this must be always a permission required. No?
  
  I will similarly update the other CiviCRM instances I administer before applying the 4.6.3 update. I am relieved I did NOT have to rebuild the CiviCRM database this time to correct the error!
  
  I am thankful,
  
  username_0
  
  
  ---
  
  