Get 2024 Templates Mega Bundle!14 Bootstrap, Vue & React Templates + 3 Vector Sets
Get for 99$

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
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (7)


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



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,

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

This might be helpful: https://stackoverflow.com/questions/53061182/mysql-connection-over-ssl-with-laravel

Kind regards,
Jaden



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()



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.


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(