Temporarily modify the sql_mode of the mysql container
1. Query sql error: sqlstate[42000]: Syntax Error or Access Violation: 1055 expression #2 of select list is not in group by clause and contain Nonaggregated Columnmodel.group_idwhich is not functionally depend on columns in group by cluse; as shown in Figure 1
2. Connect mysql in the container and execute the command: mysql -h127.0.0.1 -u username -p password. as shown in Figure 2
root@mysql-696746d44d-mzc8d:/# mysql -h127.0.0.1 -umysql -phqy-webtv
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 17304526
Server version: 5.7.34 MySQL Community Server (GPL)
Copyright (c) 2000, 2021, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
3. Temporarily modify the sql_mode of the mysql container, and execute the command: set global sql_mode=Strict_all_tables, Strict_trans_tables, no_zero_in_date, no_zero_date, e RROR_FOR_DIVISION_BY_ZERO, NO_AUTO_CREATE_USER, NO_ENGINE_SUBSTITUTION; . Temporary scenario, once the MySQL container is upgraded or redeployed, the command needs to be executed again, and the persistent scheme should be put this setting item into the basic image. as shown in Figure 3
mysql> set global sql_mode='STRICT_ALL_TABLES,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
Query OK, 0 rows affected (0.00 sec)
mysql>
4. The query SQL does not report an error again, and the interface responds normally. as shown in Figure 4
![查询 SQL 报错:SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'model.group_id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by。](https://www.shuijingwanwq.com/wp-content/uploads/2021/11/1-1.png)


