Super Sale Limited Time 50% OFF for All-Access Plans
Save 50% Now

Laravel Error After successful Install:


vendor/laravel/framework/src/Illuminate/Database/Connection.php:716
712â–• // If an exception occurs when attempting to run a query, we'll format the error
713â–• // message to include the bindings with SQL, which will make this exception a
714â–• // lot more helpful to the developer instead of just the database's errors.
715â–• catch (Exception $e) {
➜ 716▕ throw new QueryException(
717â–• $query, $this->prepareBindings($bindings), $e
718â–• );
719â–• }
720â–• }

+41 vendor frames
42 artisan:37
Illuminate\Foundation\Console\Kernel::handle()

i get this error when running php artisan migrate:fresh --seed


Any pointer as of why?

I have a database from Digital ocean and I have put in all the right details to complete it


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (7)


SOLUTION: FOR DIGITALOCEAN USERS: SET PRIMARY KEY REQUIRED TO OFF VIA THE API

PATCH A COMMAND TO THE FOLLOWING:


{
"config": {
"sql_mode": "ANSI,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION,NO_ZERO_DATE,NO_ZERO_IN_DATE,STRICT_ALL_TABLES",
"sql_require_primary_key": false
}
}


IT WILL INSTALL WONDERFULLY AFTER!



Hi Kenneth,

Great solution! Hope it can help others as well.


UPDATE! CONNECTED TO DATABASE: ITS RECEIVING AND SENDING CALLS. THIS IS THE FULL ERROR:

root@LARAVEL9-MAIN-FRAMEWORK:/var/www/html# php artisan migrate:fresh --seed Dropped all tables successfully. Migration table created successfully. Migrating: 2014_10_12_000000_create_users_table Migrated: 2014_10_12_000000_create_users_table (12.45ms) Migrating: 2014_10_12_100000_create_password_resets_table

Illuminate\Database\QueryException

SQLSTATE[HY000]: General error: 3750 Unable to create or change a table without a primary key, when the system variable 'sql_require_primary_key' is set. Add a primary key to the table or unset this variable to avoid this message. Note that tables without a primary key can cause performance problems in row-based replication, so please consult your DBA before changing this setting. (SQL: create table password_resets (email varchar(255) not null, token varchar(255) not null, created_at timestamp null) default character set utf8mb4 collate 'utf8mb4_unicode_ci' engine = InnoDB ROW_FORMAT=DYNAMIC)

at vendor/laravel/framework/src/Illuminate/Database/Connection.php:716 712▕ // If an exception occurs when attempting to run a query, we'll format the error 713▕ // message to include the bindings with SQL, which will make this exception a 714▕ // lot more helpful to the developer instead of just the database's errors. 715▕ catch (Exception $e) { ➜ 716▕ throw new QueryException( 717▕ $query, $this->prepareBindings($bindings), $e 718▕ ); 719▕ } 720▕ }

  +9 vendor frames 

10 database/migrations/2014_10_12_100000_create_password_resets_table.php:20 Illuminate\Support\Facades\Facade::__callStatic()

  +33 vendor frames 

44 artisan:37 Illuminate\Foundation\Console\Kernel::handle()


Hi,

If I remember correctly DigitalOcean uses self-signed certificates and require SSL to connect to their database servers.

This might be helpful:

Kind regards,
Jaden



Yes I have. Its a digital ocean database. Still cannot connect. It says it requires ssl connection



Hi Kenneth,

Could you please verify with Digital Ocean if this issue was caused by their side? Please verify if you use the correct database host URL and the correct port.
The SSL connection issue seems related to the server itself.

Thanks



Hi Kenneth,

Are there any more detailed errors?

Have you filled in the database details in the .env file?


DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel2
DB_USERNAME=root
DB_PASSWORD=


Thanks


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(