欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

源码安装MySQL5.6.39后,修改配置文件启动报错

程序员文章站 2022-06-16 13:27:50
环境:CentOS6.4+MySQL5.6.39 Case复现: 源码安装MySQL5.6.39,不修改配置文件初始化后启动mysql,此时服务正常启动且已产生配置文件/etc/my.cnf,但配置文件中参数项很少,手动修改/etc/my.cnf文件如下: [client] #password = ......

环境:CentOS6.4+MySQL5.6.39

Case复现:

         源码安装MySQL5.6.39,不修改配置文件初始化后启动mysql,此时服务正常启动且已产生配置文件/etc/my.cnf,但配置文件中参数项很少,手动修改/etc/my.cnf文件如下:

[client]

#password       = your_password

port            = 3306

socket          = /opt/mysql/databases/mysql.sock

[mysqld]

port            = 3306

socket          = /opt/mysql/databases/mysql.sock

skip-external-locking

skip_name_resolve

key_buffer_size = 32M

max_allowed_packet = 32M

table_open_cache = 1024

sort_buffer_size = 4M

read_buffer_size = 8M

read_rnd_buffer_size = 4M

myisam_sort_buffer_size = 64M

bulk_insert_buffer_size = 64M

tmp_table_size = 32M

max_heap_table_size = 32M

thread_cache_size = 1000

query_cache_size = 0

query_cache_type = 0

max_connections=1000

max_connect_errors = 1000000

sync_binlog = 100

long_query_time = 2

slow_query_log_file = /opt/mysql/databases/mysql-slow_3306.log  #该参数与5.5版本有区别

datadir = /opt/mysql/databases

log_error=/opt/mysql/databases/error.log

pid-file=/opt/mysql/databases/mysql.pid

log-bin=mysql-bin

binlog_format=rows

server-id       = 1

innodb_write_io_threads = 8

innodb_read_io_threads = 8

innodb_open_files = 65535

innodb_flush_method = O_DIRECT

innodb_max_dirty_pages_pct=50

innodb_file_per_table = 1

innodb_flush_log_at_trx_commit=2

innodb_log_buffer_size = 32M

innodb_log_files_in_group = 2

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

然后重新启动mysql服务报错: ERROR! The server quit without updating PID file (/opt/mysql/databases/mysql.pid). 但mysql错误日志却没有记录任何错误信息。

 

解决办法:重新初始化mysql

cd /opt/mysql/scripts

./mysql_install_db  --user=mysql --basedir=/opt/mysql --datadir=/opt/mysql/databases/

重启mysql服务,启动成功。