V
V
Vladislav Startsev2022-04-14 19:30:04
MySQL
Vladislav Startsev, 2022-04-14 19:30:04

Error when querying the database, hosting, what to do?

I am developing a site on Laravel 8, an error occurs when grouping, everything is fine on the home PC, there is an error on the hosting, in the settings (config/database) 'strict' => false, I registered. But still an error. I tried to send a request to phpMyAdmin, it sends normally Can you tell me what's wrong?

The site is hosted on jino.ru Error

text with the query
Illuminate\Database\QueryException
SQLSTATE[42000]: Syntax error or access violation: 1055 'es-vlad_ucsnemaservis.users.full_name' isn't in GROUP BY (SQL:

select distinct `users`.`id`, `users`.`full_name`, `users`.`birthday`, `users`.`programm_type`, `users`.`created_at`, `users`.`online`, `users`.`status`, `subdivisions`.`title` as `subdivision`, `positions`.`title` as `position`, `education_session`.`test_default`, `education_session`.`test_additional` 
from `users` 
left join `subdivisions` on `users`.`subdivision` = `subdivisions`.`id` 
left join `positions` on `users`.`position` = `positions`.`id` 
left join `education_session` on `users`.`id` = `education_session`.`user_id` and `education_session`.`last` = 1 
left join `test_history` on `education_session`.`id` = `test_history`.`session_id` 
where `users`.`role_id` = 0 and `test_history`.`theme_id` in (6, 11) and `test_history`.`protocol` = 1 
group by `users`.`id` 
order by `users`.`full_name` asc limit 25 offset 0


In config/database it says:
'mysql' => [
            'driver' => 'mysql',
            'url' => env('DATABASE_URL'),
            'host' => env('DB_HOST', '127.0.0.1'),
            'port' => env('DB_PORT', '3306'),
            'database' => env('DB_DATABASE', 'forge'),
            'username' => env('DB_USERNAME', 'forge'),
            'password' => env('DB_PASSWORD', ''),
            'unix_socket' => env('DB_SOCKET', ''),
            'charset' => 'utf8mb4',
            'collation' => 'utf8mb4_unicode_ci',
            'prefix' => '',
            'prefix_indexes' => true,
            'strict' => false,
            'engine' => null,
            'options' => extension_loaded('pdo_mysql') ? array_filter([
                PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
            ]) : [],
        ],

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
galaxy, 2022-04-14
@galaxy

What version of mysql is hosted? Judging by this - 5.5.x.
Mysql learned to define functional dependencies between columns in version 5.7
On the other hand, I don’t understand the meaning of this query at all - there are still no aggregations there, why grouping?
It is likely that turning off only_full_group_byfromsql_mode

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question