1

I am using https://box.scotch.io/ (vagrant).

I'm trying to install Craft 3 with the cli, but can't get past these errors:

  • Connection refused
  • No such file or directory

One or the other error shows up depending on what I use for the host name.

  • I have tried the answer here.
  • I can connect fine with Sequel Pro using the same credentials.

(Note: I did intentionally change the db name and password from the defaults that came with Scotchbox, and have successfully connected with those new details using Sequel Pro).

See log:

Which database driver are you using? [mysql,pgsql,?]: mysql
Database server name or IP address: [192.168.33.10] 
Database port: [3306] 
Database username: [root] 
Database password: 
Database name: [craft] 
Database table prefix: 
Testing database credentials... failed: SQLSTATE[HY000] [2002] Connection refused
Which database driver are you using? [mysql,pgsql,?]: mysql
Database server name or IP address: [192.168.33.10] localhost
Database port: [3306] 
Database username: [root] 
Database password: 
Database name: [craft] 
Database table prefix: 
Testing database credentials... failed: SQLSTATE[HY000] [2002] No such file or directory
Which database driver are you using? [mysql,pgsql,?]: mysql
Database server name or IP address: [localhost] 127.0.0.1
Database port: [3306] 
Database username: [root] 
Database password: 
Database name: [craft] 
Database table prefix: 
Testing database credentials... failed: SQLSTATE[HY000] [2002] Connection refused

3 Answers 3

1

This is all very specific to the box you're using, and how it's configured. I realize Scotch Box is a historically popular setup; you might also consider Homestead as it is geared specifically for PHP development.

Anyway, according to the Scotch Box docs the setup should be:

Database Host: localhost Database User: root Database Password: root

Which I assume you're doing in the second example? You are also running all of this from inside of the box, yes?

1

The default database name created by Scotchbox is scotchbox, not Craft, and the DB Password is root.

You can find the DB connection details in the Scotchbox Docs.

7
  • The database name should be the name of the database. If he chose the name craft it is craft. If he created a database with the name foo it will be that. The same goes for the password as well. You can set/change it. These values are not "hard-coded" Jan 10, 2018 at 15:45
  • @RobinSchambach If the OP provisioned a Scotchbox, which he clearly says he did, then the database is created with the name Scotchbox with username password root:root by default, as stated in the Scotchbox docs… box.scotch.io/docs Jan 10, 2018 at 16:04
  • But he could have created a new one. You could have asked him if that's the case or if he didn't -so you could hint about the docs and the default values but it sounded like it's impossible to create a db called craft Jan 10, 2018 at 16:06
  • Thanks for the downvote though @RobinSchambach. Jan 10, 2018 at 16:07
  • He doesn't say he created a new DB, he does say he used Scotchbox, so I told him the connection parameters he needs to connect to a Scotchbox provisioned database which is what he asked. Sigh. Jan 10, 2018 at 16:09
1

Fully detailed video on how to install Craft with Scotchbox is here:

https://craftquest.io/courses/localhosting-craft-cms/4312

Missing step is SSHing into vagrant box

Your Answer

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

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