Przy zapytaniu i rozmiar bazy danych:

SELECT * , sum( data_length + index_length ) AS db_size_mb FROM information_schema.TABLES WHERE table_schema = 'crm' GROUP BY table_schema ;

Dostaję taki błąd:

#1055 - Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'information_schema.TABLES.TABLE_CATALOG' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

Naprawa:

sudo vim /etc/mysql/conf.d/mysql.cnf

Dodaj:

[mysqld]
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

i restart usługi:

sudo service mysql restart

Źródło: https://stackoverflow.com/questions/37951742/1055-expression-of-select-list-is-not-in-group-by-clause-and-contains-nonaggr

Wersja #2

SET GLOBAL sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));

Źródło: https://stackoverflow.com/questions/23921117/disable-only-full-group-by

Wersja #3

sudo vim /lib/systemd/system/mysql.service
ExecStart=/usr/sbin/mysqld --sql-mode=STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION
sudo systemctl daemon-reload
sudo service mysql restart

Źródło: https://serverfault.com/questions/1019823/cannot-set-sql-mode-to-mysql-8

Dodaj komentarz

Brak komentarzy, bądź pierwszy i dodaj swój komentarz