mysql启动报错之[ERROR] Found option without preceding group in config file /etc/my.cnf at line
·
今天碰到一个特别郁闷的问题,启动mysql数据库时报错:[ERROR] Found option without preceding group in config file /etc/my.cnf at line 7!
我进行了以下几步进行了排除检查
my.cnf文件编码格式的调整
1、notepad++保存文件确保编码使用utf-8
2、安装dos2unix并进行转换
yum install dos2unix
dos2unix /etc/my.cnf
3、vim编辑文件底部显示[converted],vim编辑时输入以下内容
:set fileencoding=utf-8
然后保存
然而这三种方法都解决不了
调整my.cnf内容
之前datadir前面是没有[mysqld]的,后面发现调整了[mysqld]才顺利解决了
[mysqld]
datadir=/opt/mysql/data
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
log-error=/opt/mysql/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
sql_mode=STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
innodb_buffer_pool_size = 10G
innodb_log_buffer_size = 16M
#innodb_max_dirty_pages_pct = 80
innodb_flush_log_at_trx_commit=0
innodb_log_file_size = 256M
innodb_buffer_pool_instances = 12
innodb_purge_threads = 12
innodb_flush_method=O_DIRECT
#innodb_use_sys_malloc = 0
innodb_read_io_threads=12
innodb_write_io_threads=12
#innodb_old_blocks_time=1000
preload_buffer_size=1G
thread_cache_size = 1024
query_cache_type=1
query_cache_size= 64M
max_connections = 100000
table_open_cache = 1024
#table_cache_size = 1024
table_definition_cache = 1024
tmp_table_size = 256M
max_heap_table_size = 300M
binlog_cache_size = 4M
thread_stack = 512K
read_buffer_size = 4M
key_buffer_size = 64M
#myisam_sort_buffer_size = 64M
join_buffer_size = 128M
sort_buffer_size = 64M
read_rnd_buffer_size = 64M
innodb_page_size=8K
#collation_server=utf8mb4_general_ci
#innodb_file_format=BARRACUDA
#innodb_file_per_table = ON
#innodb_large_prefix=1
#default-character-set= utf8mb4
character-set-server = utf8
innodb_large_prefix=on
#collation-server = utf8mb4_unicode_ci
# [mysql]
更多推荐
已为社区贡献3条内容
所有评论(0)