Skip to content

PHP Spark Migrate Issue, database: Connection refused #305

@bribar

Description

@bribar

System Environment:
macOS Monterey 12.4
MAMP Pro 6.6

  • PHP 7.4.21
  • Apache 2.4.46
  • MySql 5.7.34

Codeigniter is latest version

I've seen the other issues posted in regards to Sqlite and database connection issues, but they don't seem to fix.

I followed the appstarter instructions here https://codeigniter4.github.io/userguide/installation/installing_composer.html

Codeigniter:
Updated Config\App.php base url
Updated Config\Database.php settings for my DB (not using env file)
Checked Config\Logger and threshold set to 4

Through the Home Controller (Browser) I can successfully connect to DB and make a simple query that returns results so I know my database settings are valid

When I proceed to install Shield following these instructions https://github.com/codeigniter4/shield/blob/develop/docs/install.md and running "php spark migrate" (tried the -all option too, also I've removed the _support tests like suggested.) it throws two errors depending on the settings below...

Using these settings:

public $default = [ 'DSN' => '', 'hostname' => 'localhost', 'username' => 'root', 'password' => 'root', 'database' => 'btb', 'DBDriver' => 'MySQLi', 'DBPrefix' => '', 'pConnect' => false, 'DBDebug' => (ENVIRONMENT !== 'production'), 'charset' => 'utf8', 'DBCollat' => 'utf8_general_ci', 'swapPre' => '', 'encrypt' => false, 'compress' => false, 'strictOn' => false, 'failover' => [], 'port' => 3306, ];

Running the command logs "ERROR - 2022-07-20 19:11:46 --> Error connecting to the database: No such file or directory"

Only changing localhost => 127.0.0.1

Running the command logs "ERROR - 2022-07-20 19:15:05 --> Error connecting to the database: Connection refused"

Doesn't tell me why it's refused...

I've only made the necessary changes to settings to make it run. I haven't moved folders, like the public folder, that some have suggested might be the issue.

Also running "php spark shield:setup" spits out - Command "shield:setup" not found. Probably cause previous commands are failing?

It's a very base install to test Shield. Pretty sure all my system requirements are adequate. Not sure what else to do.

Folder structure is:
ci4 folder -> appstarter folder -> framework folders (app,public,vendor, etc)

Did I miss a solution for my case? Can I manually create necessary DB tables for Shield and skip the migration and do the Manual Setup?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions