安裝很多次mysql,linux,windows版本的都有遇到的問題,總是不總結,結果就是走很多彎路,所以此次記錄一下。
1.首先安裝完mysql8.0.21 后,發現無my.ini,解決辦法
1)默認安裝到c盤會自動隱藏,記得打開隱藏文件找到他
2)找不到的情況下,在mysql的安裝目錄下新建my.ini文件(注意:剛新建完是沒有小齒輪的,需要以下配置信息添加進去)
# For advice on how to change settings please see # http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html # *** DO NOT EDIT THIS FILE. It's a template which will be copied to the # *** default location during install, and will be replaced if you # *** upgrade to a newer version of MySQL. [client] default-character-set = utf8mb4 [mysql] default-character-set = utf8mb4 [mysqld] character-set-client-handshake = FALSE character-set-server = utf8mb4 collation-server = utf8mb4_bin init_connect='SET NAMES utf8mb4' # 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 # These are commonly set, remove the # and set as required. basedir = E:\mysql-8.0.21-winx64 datadir = E:\mysql-8.0.21-winx64\data port = 3306 # server_id = ..... # 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=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
2.報錯[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'information_schema.PROFILING.SEQ' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
1)網上的解決方案都是修改sql_mode 但是因為我的my.ini沒有這個文件,怎么改都不生效,如果您也遇到同樣的問題記得先把第一步操作了,重新啟動mysq
2)在添加my.ini文件的時候就把sql_mode參數添加進去
3)該方法若mysql重啟則失效
mysql中執行 show variables like '%sql_mode';
set @@GLOBAL.sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';