NomisCZ / hlstatsx-community-edition

HLstatsX Community Edition - PHP 7 and GeoIP2 supported
GNU General Public License v2.0
83 stars 48 forks source link

Database Error - incompatible with sql_mode=only_full_group_by #34

Closed szogi1910 closed 5 years ago

szogi1910 commented 5 years ago

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. Go to 'hlstats.php?mode=playerinfo&player'
  2. Click on 'weapons , Team & Action'
  3. Scroll down to '....'
  4. See error
Server Username: xxx_statshl
Error Diagnostic:
Bad query.
Server Error: (1055) Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'admin_hlstats.hlstats_Weapons.modifier' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
Server Username: xxx_statshl
Error Diagnostic:
Bad query.

Server Error: (1055) Expression #5 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'admin_hlstats.hlstats_Frags_as_res.killsTotal' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

Environment

NomisCZ commented 5 years ago

Hi @szogi1910, please check this thread - https://forums.alliedmods.net/showthread.php?t=317302

It's a problem with MySQL servers 5.7 and newer. Older MySQL servers have this option enabled by default. HLStatsX website is old, so some things aren't according to the new standards.

  1. Edit /etc/mysql/my.cnf
    [mysqld]
    sql_mode = "STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
  2. Restart mysql server - systemctl restart mysql (or service mysql restart)