一般linux 上都放在 /etc/my.cnf ,window 上安装都是默认可能按照上面的路径还是没找到, window 上 可以登录到mysql中 使用 show variables like '%data%' 先找到data 存放路径, 一般my.ini 在 data文件的上一级。
win下的是my.ini,一般会在安装目录的根目录。
举例:
Windows7电脑上的方法。
1)从任务栏找到MySQL Notifier,右键单击,选择“SQL Editor”打开
2)可以看到MySQL Workbench被打开,从左侧边栏Navigator选择Options File;如果左侧没有Navigator,那么在右上角选择显示左侧边栏的选项。
3)在Workbench下部可以看到Configuration File所处的位置,即为my.ini的路径。
扩展资料:
使用 mysql --help 查看关于MYSQL对应 配置文件my.cnf 搜索顺序,windows 和linux 上都是该命令查看; linux 上可以使用 mysql --help|grep my.cnf 过滤查看。
参考资料:mysql--MYSQL官网
[client]port = 3306
socket = /tmp/mysql.sock
[mysqld]
##########################################################################################################
server-id = 1
port = 3306
user = mysql
##########################################################################################################
basedir = /usr/local/mysql-5.7.21
datadir = /usr/local/mysql-5.7.21/data
tmpdir = /tmp
socket = /tmp/mysql.sock
##########################################################################################################
transaction_isolation = REPEATABLE-READ
##########################################################################################################
default_storage_engine = InnoDB
default_tmp_storage_engine = InnoDB
internal_tmp_disk_storage_engine = InnoDB
character-set-server = utf8
collation-server = utf8_general_ci
lower_case_table_names = 1
##########################################################################################################
max_connections = 10000
max_connect_errors = 10000
open_files_limit = 65535
interactive_timeout = 1800
wait_timeout = 1800
back_log = 900
##########################################################################################################
max_allowed_packet = 128M
##########################################################################################################
tmp_table_size = 64M
max_heap_table_size = 64M
query_cache_type = 0
query_cache_size = 64M
query_cache_limit = 2M
query_cache_min_res_unit = 4kb
binlog_cache_size = 1M
key_buffer_size = 64M
read_buffer_size = 262144
read_rnd_buffer_size = 1M
sort_buffer_size = 1M
join_buffer_size = 1M
table_open_cache = 2000
table_definition_cache = 1400
table_open_cache_instances = 2
thread_cache_size = 16
thread_stack = 512k
##########################################################################################################
general_log = 0
general_log_file = /usr/local/mysql-5.7.21/log/mysql-general.log
log_error_verbosity = 2
log_error = /usr/local/mysql-5.7.21/log/mysql-error.log
slow_query_log = 1
long_query_time = 3
min_examined_row_limit = 100
log_throttle_queries_not_using_indexes = 0
slow_query_log_file = /usr/local/mysql-5.7.21/log/mysql-slow.log
log-queries-not-using-indexes = 1
log_bin = /usr/local/mysql-5.7.21/log/mysql-bin.log
expire_logs_days = 0
max_binlog_size = 1000M
binlog_format = row
##########################################################################################################
innodb_page_cleaners = 4
innodb_page_size = 16384
innodb_buffer_pool_size = 512M
innodb_buffer_pool_instances = 1
innodb_buffer_pool_chunk_size = 128M
innodb_buffer_pool_load_at_startup = 1
innodb_buffer_pool_dump_at_shutdown = 1
innodb_lru_scan_depth = 1024
innodb_lock_wait_timeout = 60
innodb_io_capacity = 2000
innodb_io_capacity_max = 4000
innodb_flush_method = O_DIRECT
innodb_file_per_table = 1
innodb_undo_directory = /usr/local/mysql-5.7.21/log
innodb_undo_tablespaces = 0
innodb_undo_logs = 128
innodb_undo_log_truncate = 1
innodb_max_undo_log_size = 1G
innodb_log_group_home_dir = /usr/local/mysql-5.7.21/log
innodb_log_file_size = 128M
innodb_log_files_in_group = 3
innodb_log_buffer_size = 16M
innodb_flush_log_at_timeout = 1
innodb_flush_log_at_trx_commit = 1
innodb_open_files = 8192
innodb_read_io_threads = 4
innodb_write_io_threads = 4
innodb_thread_concurrency = 0
innodb_purge_threads = 4
innodb_old_blocks_pct = 37
innodb_old_blocks_time=1000
innodb_use_native_aio = 1
innodb_data_home_dir=/usr/local/mysql-5.7.21/data
innodb_data_file_path = ibdata1:12M:autoextend
##########################################################################################################
explicit_defaults_for_timestamp = 1
[mysqldump]
quick
max_allowed_packet = 16M
[mysql]
auto-rehash
socket = /tmp/mysql.sock
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)