Answers.Body: <p>Just in case anybody else has this issue when they try to use amp config with CiviBuild.  It is probably not entirely clear that you <strong>first need to create the user</strong> that you are inputting into the Enter dsn&gt;</p>
  <p>You first need to create a user in mysql with sufficent privileges.  Remember, one does not log in as root anymore! Use 'sudo su' and then run your MySQL commands. There are plenty of resources to show you how to do this, but on MySQL ver 5.7.heres's what to do:</p>
  <p>user@ubuntu: sudo su</p>
  <p>user@ubuntu: mysql</p>
  <p>mysql&gt; CREATE USER 'newusername'@'localhost' IDENTIFIED BY 'yourpassword';</p>
  <p>This creates your new user - just replace 'newusername' with whatever you wish e.g. 'itadmin'.  The same goes for the password (the security is up to you but be secure if you ever build production servers)</p>
  <p>Now grant the permssions that amp requires:</p>
  <p>mysql&gt; GRANT ALL PRIVILEGES ON * . * TO 'newusername'@'localhost' WITH GRANT OPTION;</p>
  <p>Flush all privileges with:</p>
  <p>mysql&gt;FLUSH PRIVILEGES;</p>
  <p>The WITH GRANT OPTION is important as this will allow the user to be able to grant options on other users by a script.</p>
  <p>exit from Mysql and then from su with two lots of exit command.  You now have a user that you can put into amp config for the dsn section.</p>
  <p>Remember! You have just created what is effectively a root user on your MySQL database</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-02-08T20:20:24.010Z
Answers.Text: thanks @ChumKui , checking out the answer :)
Answers.UserDisplayName: Joe McLaughlin
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-02-05T15:44:30.290Z
Answers.LastActivityDate: 2021-02-12T13:52:06.413Z
Answers.LastEditDate: 2021-02-12T13:52:06.413Z
Answers.UserDisplayName: ChumKui
Answers.Body: <p>So, duh. I haven't totally figured out the problem - now I'm getting this - </p>
  
  <p><code>SQLSTATE[HY000] [2002] Connection refused</code> </p>
  
  <p>but the <code>Access denied</code> issue was a simple fix, i.e., use <code>chmod</code>. </p>
  
  <p>See "How to Run MySQL as a Normal User" at <a href="https://dev.mysql.com/doc/refman/5.7/en/changing-mysql-user.html" rel="nofollow noreferrer">https://dev.mysql.com/doc/refman/5.7/en/changing-mysql-user.html</a> . </p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-09-05T03:48:07.190Z
Answers.LastActivityDate: 2019-09-05T03:48:07.190Z
Answers.UserDisplayName: Joe McLaughlin
Body: <p>I'm trying to install buildkit on my Ubuntu 19.04 laptop, per the instructions at <a href="https://docs.civicrm.org/dev/en/latest/tools/buildkit/#config" rel="nofollow noreferrer">https://docs.civicrm.org/dev/en/latest/tools/buildkit/#config</a> </p>
  
  <p>I've used curl to run the script, successfully - <code>civicbuild -h</code> works - and am now on the <code>amp config</code> step. </p>
  
  <p>When trying to create a mysql_dsn using either </p>
  
  <p><code>mysql://joe:randompass@127.0.0.1:3306</code> or <code>mysql://joe:pass@localhost:3306</code></p>
  
  <p>I get this error:</p>
  
  <p><code>SQLSTATE[HY000] [1045] Access denied for user 'joe'@'localhost' (using password: YES)</code></p>
  
  <p>Running <code>amp config:get</code> does not show an existing <code>mysql_type</code> , which I think means there is not an existing mysql database that I can't log in to. </p>
  
  <p>Running <code>amp cleanup</code> shows <code>Destroyed 0 instance(s)</code></p>
  
  <p>Running <code>amp show</code> returns an empty list</p>
  
  <p>Running <code>amp test</code> shows this error: </p>
  
  <pre><code>PHP Fatal error:  Uncaught Error: Call to a member function getDriver() on null in phar:///home/joe/buildkit/bin/amp/src/Amp/Database/MySQL.php:59
  Stack trace:
  #0 phar:///home/joe/buildkit/bin/amp/src/Amp/InstanceRepository.php(56): Amp\Database\MySQL-&gt;createDatasource('canary')
  #1 phar:///home/joe/buildkit/bin/amp/src/Amp/Command/CreateCommand.php(107): Amp\InstanceRepository-&gt;create(Object(Amp\Instance), true, true, 'admin')
  #2 phar:///home/joe/buildkit/bin/amp/vendor/symfony/console/Symfony/Component/Console/Command/Command.php(252): Amp\Command\CreateCommand-&gt;execute(Object(Symfony\Component\Console\Input\ArrayInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
  #3 phar:///home/joe/buildkit/bin/amp/src/Amp/Command/ContainerAwareCommand.php(26): Symfony\Component\Console\Command\Command-&gt;run(Object(Symfony\Component\Console\Input\ArrayInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
  #4 phar:///home/joe/buildkit/bin/amp/src/Amp/Command/TestCommand.php(65): Amp\Command\ContainerAwareCommand-&gt;doComman in phar:///home/joe/buildkit/bin/amp/src/Amp/Database/MySQL.php on line 59
  </code></pre>
  
  <p>I'm trying to figure out the error message, Googling that.   </p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-09-04T07:16:46.583Z
Comments.Text: I'm sure you will have tried this, but you don't mention it... can you login with those details via mysql command line?
Comments.UserDisplayName: Aidan
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-09-04T17:53:52.417Z
Comments.Text: @Aidan yeah so I did a purge of MySQL stuff, reinstalled, can get to the >mysql command line, created a new root account, created a new dummy table, that all works. Tried to create a mysql_dsn again using amp config and for user joe, still get the same error - Access denied. Came across this, link below, which is similar, thinking there's some issue with leftover docker settings when I was trying civicrm-buildkit-docker - https://github.com/michaelmcandrew/civicrm-buildkit-docker/issues/28 .
Comments.UserDisplayName: Joe McLaughlin
Tags: <mysql><civicrm-buildkit>
Title: mysql_dsn error on amp config - why am I getting "access denied"?
ThreadText: # mysql_dsn error on amp config - why am I getting "access denied"?
  
  (Asked by: username_0 on 2019-09-04)
  
  I'm trying to install buildkit on my Ubuntu 19.04 laptop, per the instructions at <https://docs.civicrm.org/dev/en/latest/tools/buildkit/#config>
  
  I've used curl to run the script, successfully - `civicbuild -h` works - and am now on the `amp config` step.
  
  When trying to create a mysql\_dsn using either
  
  `mysql://joe:randompass@127.0.0.1:3306` or `mysql://joe:pass@localhost:3306`
  
  I get this error:
  
  `SQLSTATE[HY000] [1045] Access denied for user 'joe'@'localhost' (using password: YES)`
  
  Running `amp config:get` does not show an existing `mysql_type` , which I think means there is not an existing mysql database that I can't log in to.
  
  Running `amp cleanup` shows `Destroyed 0 instance(s)`
  
  Running `amp show` returns an empty list
  
  Running `amp test` shows this error:
  
  ```
  PHP Fatal error:  Uncaught Error: Call to a member function getDriver() on null in phar:///home/joe/buildkit/bin/amp/src/Amp/Database/MySQL.php:59
  Stack trace:
  #0 phar:///home/joe/buildkit/bin/amp/src/Amp/InstanceRepository.php(56): Amp\Database\MySQL->createDatasource('canary')
  #1 phar:///home/joe/buildkit/bin/amp/src/Amp/Command/CreateCommand.php(107): Amp\InstanceRepository->create(Object(Amp\Instance), true, true, 'admin')
  #2 phar:///home/joe/buildkit/bin/amp/vendor/symfony/console/Symfony/Component/Console/Command/Command.php(252): Amp\Command\CreateCommand->execute(Object(Symfony\Component\Console\Input\ArrayInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
  #3 phar:///home/joe/buildkit/bin/amp/src/Amp/Command/ContainerAwareCommand.php(26): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArrayInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
  #4 phar:///home/joe/buildkit/bin/amp/src/Amp/Command/TestCommand.php(65): Amp\Command\ContainerAwareCommand->doComman in phar:///home/joe/buildkit/bin/amp/src/Amp/Database/MySQL.php on line 59
  
  ```
  
  I'm trying to figure out the error message, Googling that.
  
  **Tags:** mysql, civicrm-buildkit
  
  > **Comments:**
  > **username_1**: I'm sure you will have tried this, but you don't mention it... can you login with those details via mysql command line?  
  > **username_0**: @username_1 yeah so I did a purge of MySQL stuff, reinstalled, can get to the >mysql command line, created a new root account, created a new dummy table, that all works. Tried to create a mysql_dsn again using amp config and for user joe, still get the same error - Access denied. Came across this, link below, which is similar, thinking there's some issue with leftover docker settings when I was trying civicrm-buildkit-docker - https://github.com/michaelmcandrew/civicrm-buildkit-docker/issues/28 .  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2021-02-05. Score: 2
  
  Just in case anybody else has this issue when they try to use amp config with CiviBuild. It is probably not entirely clear that you **first need to create the user** that you are inputting into the Enter dsn>
  
  You first need to create a user in mysql with sufficent privileges. Remember, one does not log in as root anymore! Use 'sudo su' and then run your MySQL commands. There are plenty of resources to show you how to do this, but on MySQL ver 5.7.heres's what to do:
  
  user@ubuntu: sudo su
  
  user@ubuntu: mysql
  
  mysql> CREATE USER 'newusername'@'localhost' IDENTIFIED BY 'yourpassword';
  
  This creates your new user - just replace 'newusername' with whatever you wish e.g. 'itadmin'. The same goes for the password (the security is up to you but be secure if you ever build production servers)
  
  Now grant the permssions that amp requires:
  
  mysql> GRANT ALL PRIVILEGES ON \* . \* TO 'newusername'@'localhost' WITH GRANT OPTION;
  
  Flush all privileges with:
  
  mysql>FLUSH PRIVILEGES;
  
  The WITH GRANT OPTION is important as this will allow the user to be able to grant options on other users by a script.
  
  exit from Mysql and then from su with two lots of exit command. You now have a user that you can put into amp config for the dsn section.
  
  Remember! You have just created what is effectively a root user on your MySQL database
  
  > **Comments:**
  > **username_0**: thanks @username_2 , checking out the answer :)  
  
  ---
  
  ### Answer by username_0 on 2019-09-05. Score: 1
  
  So, duh. I haven't totally figured out the problem - now I'm getting this -
  
  `SQLSTATE[HY000] [2002] Connection refused`
  
  but the `Access denied` issue was a simple fix, i.e., use `chmod`.
  
  See "How to Run MySQL as a Normal User" at <https://dev.mysql.com/doc/refman/5.7/en/changing-mysql-user.html> .
  
  
  ---
  
  