laravel-backup: Exception message: The dump process failed with exitcode 2 : Misuse of shell builtins : mysqldump: Got error: 2003

I am running into this error. I am able to connect to the database with the correct credentials and I can run mysqldump from the terminal with the same credentials. I have tried setting the binary path with no luck. I have tripled checked that I am using the correct credentials. I have tried changing the host from ‘127.0.0.1’ to localhost. I have this package on other laravel sites on the same server with no issue. I am almost ready to give up. Any help would be appreciated. Thank you.

Exception message: The dump process failed with exitcode 2 : Misuse of shell builtins : mysqldump: Got error: 2003: Can't connect to MySQL server on '127.0.0.1' (111) when trying to connect

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 1
  • Comments: 15 (2 by maintainers)

Most upvoted comments

Adding the 'dump_binary_path' => '/usr/bin/' within a “dump” array within config/database.php (see https://spatie.be/docs/laravel-backup/v6/installation-and-setup#dumping-the-database) did not work for me.

I still get:

The dump process failed with exitcode 2 : Misuse of shell builtins : mysqldump: Couldn’t execute 'SELECT COLUMN_NAME…

This worked for me though:

sudo vim /etc/mysql/my.cnf

Then edit as mentioned in https://stackoverflow.com/a/52423596/470749, and then restart your MySQL.

If it can be useful to someone, I got a similar error on a Bitnami LAMP installation on AWS:

mysqldump: Got error: 2002: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) when trying to connect

solved adding to database.php in the connection/mysql section :

'dump' => [
                'dump_binary_path' => '/opt/bitnami/mysql/bin',
                'add_extra_option' => '--socket=/opt/bitnami/mysql/tmp/mysql.sock',            ]

Have you tried running php artisan config:clear?