1. 程式人生 > 其它 >MySQL sql_mode=ONLY_FULL_GROUP_BY 相關問題解決方案

MySQL sql_mode=ONLY_FULL_GROUP_BY 相關問題解決方案

技術標籤:資料庫資料庫mysql

方案一:
SET1
通過SET設定,但這是臨時的方案,並且只有在當前會話窗口才有效,甚至設定全域性sql_mode,都只是個臨時解決方案。

方案二:
1、在MySQL根目錄下建立my.ini
2、建立data資料夾,如果是之前就已經有data了,在my.ini指向原有的data路徑即可
3、重新啟動mysql服務

[mysql]
default-character-set=utf8
[mysqld]
port = 3306

basedir=C:\Users\Admin\Documents\WorkSpace\Tools\mysql-8.0.18-winx64

datadir=C:\Users\Admin\Documents\WorkSpace\Tools\mysql-8.0.18-winx64\data

max_connections=200

character-set-server=utf8

default-storage-engine=INNODB
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
innodb_buffer_pool_size = 128M
#
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
join_buffer_size = 128M
sort_buffer_size = 16M
read_rnd_buffer_size = 16M

sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'

CentOS 修改方案見《【伺服器運維】MySQL資料儲存至資料盤