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:[email protected]: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.

  • I'm sure you will have tried this, but you don't mention it... can you login with those details via mysql command line?
    – Aidan
    Commented Sep 4, 2019 at 7:16
  • @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 - github.com/michaelmcandrew/civicrm-buildkit-docker/issues/28 . Commented Sep 4, 2019 at 17:53

2 Answers 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:


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

  • thanks @ChumKui , checking out the answer :) Commented Feb 8, 2021 at 20:20

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 .

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.