Syntax error or access violation: 1305 FUNCTION

Posted by

Limited Time Offer!

For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!

Enroll Now

Error:-

local.ERROR: SQLSTATE[42000]: Syntax error or access violation: 1305 FUNCTION professnow_bangaloreorbit.ANY_VALUE does not exist (SQL: select `city`, ANY_VALUE(poster) AS poster, COUNT(*) AS cities from `events` where (`publish` = 1 and `status` = 1) and (`events`.`publish` = 1 and `events`.`status` = 1) group by `city` order by `cities` desc limit 6) {"exception":"[object] (Illuminate\\Database\\QueryException(code: 42000): SQLSTATE[42000]: Syntax error or access violation: 1305 FUNCTION professnow_bangaloreorbit.ANY_VALUE does not exist (SQL: select `city`, ANY_VALUE(poster) AS poster, COUNT(*) AS cities from `events` where (`publish` = 1 and `status` = 1) and (`events`.`publish` = 1 and `events`.`status` = 1) group by `city` order by `cities` desc limit 6) at /home/professnow/public_html/orbit/bangaloreorbit.com/events/vendor/laravel/framework/src/Illuminate/Database/Connection.php:712)
[stacktrace]

Solution:-

Step 1:- Go inside your laravel project.

Step 2:- Open the File named database.php which is present in the Config Directory. config/database.php

Step 3:- Right now when you are facing this Syntax error or access violation: 1305 FUNCTION issue you code is :

'mysql' => [
    'driver' => 'mysql',
    'host' => env('DB_HOST', 'localhost'),
    'port' => env('DB_PORT', '3306'),
    'database' => env('DB_DATABASE', 'forge'),
    'username' => env('DB_USERNAME', 'forge'),
    'password' => env('DB_PASSWORD', ''),
    'charset' => 'utf8',
    'collation' => 'utf8_unicode_ci',
    'prefix' => '',
    'strict' => True,
    'engine' => null,
],

Step 4:- Change the ‘strict’ => True, to ‘strict’ => false, which looks like this

'mysql' => [
    'driver' => 'mysql',
    'host' => env('DB_HOST', 'localhost'),
    'port' => env('DB_PORT', '3306'),
    'database' => env('DB_DATABASE', 'forge'),
    'username' => env('DB_USERNAME', 'forge'),
    'password' => env('DB_PASSWORD', ''),
    'charset' => 'utf8',
    'collation' => 'utf8_unicode_ci',
    'prefix' => '',
    'strict' => false,
    'engine' => null,
],

Step 5:- Save and close the file.

Step 6:- Run the Config:Clear command

php artisan config:clear

Your Issue will be solved.

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x