Answers.Body: <p>MySQL 5.7 has "pluggable authentication", which means that you're not always logging in by password from your terminal.  You'll want to ensure that the <code>mysql.user</code> table shows a value of <code>mysql_native_password</code> for all users in the <code>plugin</code> column.</p>
  
  <p>If you're logging in to the terminal as the <code>root</code> user on Ubuntu 16.04, then by default you're not using <code>mysql_native_password</code>, you're using <code>auth_socket</code>.  This could lead to misleading results where you can log in from the command line with what SEEMS like a good password!  If this is your problem, you may need to install the <code>mysql_native_password</code> plugin before you can set the password.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-02-27T09:09:13.073Z
Answers.Text: I confirm that all involved users have mysql_native_password in the plugin column of the mysql.user table. That's not it
Answers.UserDisplayName: Damien
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-02-27T00:26:40.310Z
Answers.LastActivityDate: 2018-02-27T00:26:40.310Z
Answers.UserDisplayName: Jon G - Megaphone Tech
Answers.Body: <p>Look at your imported SQL file any reference to the old site mysql user and replace it with your new site user.</p>
  
  <p>CiviCRM 4.6.x has mysql user hardcoded, for exemple:</p>
  
  <p>/*!50013 DEFINER=<code>old_mysql_user</code>@<code>localhost</code> SQL SECURITY DEFINER <em>/
  /</em>!50003 CREATE*/ /<em>!50017 DEFINER=<code>old_mysql_user</code>@<code>localhost</code></em>/ /*!50003 TRIGGER civicrm_value_autoritzacions_16_after_update after update ON civicrm_value_autoritzacions_16 FOR EACH ROW BEGIN  </p>
  
  <p>This also run in an import SQL error...</p>
  
  <p>After cleaning this I get ride of your error...</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-08-24T12:58:23.067Z
Answers.LastActivityDate: 2018-08-24T12:58:23.067Z
Answers.UserDisplayName: calbasi
Body: <p>I encounter a really weird issue. I'm moving my CiviCRM install from an Ubuntu 14.04 server to an Ubuntu 16.04 server. Mysql is now 5.7.21.</p>
  
  <p>CiviCRM version is the latest 4.7.30</p>
  
  <p>The default SQL mode only_full_group_by is disabled.</p>
  
  <p>If I connect using the terminal from the same localhost using the same username/password (I triple triple triple checked), it runs like a charm.</p>
  
  <p>The CiviCRM page always shows a DB Error: unknown error (duh!). Enabling the backtrace gives me more info:</p>
  
  <pre><code>[callback] =&gt; Array
          (
              [0] =&gt; CRM_Core_Error
              [1] =&gt; handle
          )
  
      [code] =&gt; -1
      [message] =&gt; DB Error: unknown error
      [mode] =&gt; 16
      [debug_info] =&gt; 
  SELECT  v.name as name ,v.value as value, v.grouping as grouping
  FROM   civicrm_option_value_en_US v,
         civicrm_option_group_en_US g
  WHERE  v.option_group_id = g.id
    AND  g.name            = 'wysiwyg_presets'
    AND  g.is_active       = 1  AND  v.is_active = 1  AND ( v.component_id IS NULL  OR v.component_id IN (SELECT id FROM civicrm_component WHERE name IN ("CiviEvent","CiviMember","CiviMail","CiviReport")) )  ORDER BY v.weight [nativecode=1045 ** Access denied for user 'civietui'@'localhost' (using password: YES)]
  </code></pre>
  
  <p>Any help much appreciated</p>
  
  <p><strong>Update</strong></p>
  
  <p>If I deliberately use a wrong username or password, I have a different error:</p>
  
  <p>Initialization Error</p>
  
  <p>It shows that somehow, Civi connects to the DB up to a certain point</p>
  
  <p><strong>update 2</strong></p>
  
  <p>mysql> show grants for username@localhost;</p>
  
  <p>| Grants for username@localhost                                                        |</p>
  
  <p>| GRANT USAGE ON <em>.</em> TO 'username'@'localhost'                                         |
  | GRANT ALL PRIVILEGES ON <code>civicrm_DB</code>.* TO 'username'@'localhost' WITH GRANT OPTION |</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-02-27T17:52:51.787Z
Comments.Text: Two questions: First - are you using different MySQL users for your CMS and CRM?  Second - could you edit your question to show the results of `SHOW GRANTS FOR <username>`?
Comments.UserDisplayName: Jon G - Megaphone Tech
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-03-01T13:05:40.033Z
Comments.Text: 1. I do have different users for both databases
  2. I've added the result of the query in the 'update 2' part of the initial question. Thanks!
Comments.UserDisplayName: Damien
Tags: <error><mysql>
Title: Database Error Code: Access denied for user 'civi'@'localhost' (using password: YES), 1045
ThreadText: # Database Error Code: Access denied for user 'civi'@'localhost' (using password: YES), 1045
  
  (Asked by: username_0 on 2018-02-26)
  
  I encounter a really weird issue. I'm moving my CiviCRM install from an Ubuntu 14.04 server to an Ubuntu 16.04 server. Mysql is now 5.7.21.
  
  CiviCRM version is the latest 4.7.30
  
  The default SQL mode only\_full\_group\_by is disabled.
  
  If I connect using the terminal from the same localhost using the same username/password (I triple triple triple checked), it runs like a charm.
  
  The CiviCRM page always shows a DB Error: unknown error (duh!). Enabling the backtrace gives me more info:
  
  ```
  [callback] => Array
          (
              [0] => CRM_Core_Error
              [1] => handle
          )
  
      [code] => -1
      [message] => DB Error: unknown error
      [mode] => 16
      [debug_info] => 
  SELECT  v.name as name ,v.value as value, v.grouping as grouping
  FROM   civicrm_option_value_en_US v,
         civicrm_option_group_en_US g
  WHERE  v.option_group_id = g.id
    AND  g.name            = 'wysiwyg_presets'
    AND  g.is_active       = 1  AND  v.is_active = 1  AND ( v.component_id IS NULL  OR v.component_id IN (SELECT id FROM civicrm_component WHERE name IN ("CiviEvent","CiviMember","CiviMail","CiviReport")) )  ORDER BY v.weight [nativecode=1045 ** Access denied for user 'civietui'@'localhost' (using password: YES)]
  
  ```
  
  Any help much appreciated
  
  **Update**
  
  If I deliberately use a wrong username or password, I have a different error:
  
  Initialization Error
  
  It shows that somehow, Civi connects to the DB up to a certain point
  
  **update 2**
  
  mysql> show grants for username@localhost;
  
  | Grants for username@localhost |
  
  | GRANT USAGE ON *.* TO 'username'@'localhost' |
  | GRANT ALL PRIVILEGES ON `civicrm_DB`.\* TO 'username'@'localhost' WITH GRANT OPTION |
  
  **Tags:** error, mysql
  
  > **Comments:**
  > **username_1**: Two questions: First - are you using different MySQL users for your CMS and CRM?  Second - could you edit your question to show the results of `SHOW GRANTS FOR <username>`?  
  > **username_0**: 1. I do have different users for both databases 2. I've added the result of the query in the 'update 2' part of the initial question. Thanks!  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2018-02-27. Score: 1
  
  MySQL 5.7 has "pluggable authentication", which means that you're not always logging in by password from your terminal. You'll want to ensure that the `mysql.user` table shows a value of `mysql_native_password` for all users in the `plugin` column.
  
  If you're logging in to the terminal as the `root` user on Ubuntu 16.04, then by default you're not using `mysql_native_password`, you're using `auth_socket`. This could lead to misleading results where you can log in from the command line with what SEEMS like a good password! If this is your problem, you may need to install the `mysql_native_password` plugin before you can set the password.
  
  > **Comments:**
  > **username_0**: I confirm that all involved users have mysql_native_password in the plugin column of the mysql.user table. That's not it  
  
  ---
  
  ### Answer by username_2 on 2018-08-24. Score: 0
  
  Look at your imported SQL file any reference to the old site mysql user and replace it with your new site user.
  
  CiviCRM 4.6.x has mysql user hardcoded, for exemple:
  
  /\*!50013 DEFINER=`old_mysql_user`@`localhost` SQL SECURITY DEFINER */
  /*!50003 CREATE\*/ /*!50017 DEFINER=`old_mysql_user`@`localhost`*/ /\*!50003 TRIGGER civicrm\_value\_autoritzacions\_16\_after\_update after update ON civicrm\_value\_autoritzacions\_16 FOR EACH ROW BEGIN
  
  This also run in an import SQL error...
  
  After cleaning this I get ride of your error...
  
  
  ---
  
  