1. 程式人生 > >mysql報錯

mysql報錯

mysql

1. 環境說明

CentOS 6.5

[[email protected] ~]# uname -a

Linux linux-mysql02 2.6.32-431.el6.x86_64 #1 SMP Fri Nov 22 03:15:09 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux


2. 問題描述

編譯安裝MySQL-5.6.37和二進制安裝MySQL-5.6.37,在初始化mysql後,它會自動在MYSQL_BASE目錄下(/u02/mysql-5.6.37)生成一個my.cnf的文件,當然,在/etc/目錄下,它也會自動生成my.cnf,但是在啟動mysql之前被mv為my.cnf.bak了,所以mysql的第一生效文件就變為了/u02/mysql-5.6.37/my.cnf。

在需要配置binlog時,打開my.cnf看到mysqld模塊下只有這一句沒有註釋的,在網上找了下資料(https://segmentfault.com/a/1190000005936172):

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

稍微看了下這個模塊的作用,才有了註釋掉,然後重新寫個my.cnf


[[email protected] ~]# cat /etc/my.cnf

[client]

port = 3306

socket = /tmp/mysql.sock


[mysql]

no-auto-rehash


[mysqld]

user = mysql

port = 3306

#socket = /tmp/mysql.sock

#basedir = /u02/mysql

datadir = /u02/mysql-5.6.37/data

open_files_limit = 1024

back_log = 600

max_connections = 800

max_connect_errors = 3000

#table_cache = 614

external-locking = FALSE

max_allowed_packet =8M

sort_buffer_size = 1M

join_buffer_size = 1M

thread_cache_size = 100

thread_concurrency = 2

query_cache_size = 2M

query_cache_limit = 1M

query_cache_min_res_unit = 2k

#default_table_type = InnoDB

thread_stack = 192K

#transaction_isolation = READ-COMMITTED

tmp_table_size = 2M

max_heap_table_size = 2M

long_query_time = 1

#log_long_format

#log-error = /data/3306/error.log

##log-slow-queries = /data/3306/slow.log

##pid-file = /data/3306/mysql.pid

##log-bin = /tmp/mysql-bin

##relay-log = /data/3306/relay-bin

##relay-log-info-file = /data/3306/relay-log.info

binlog_cache_size = 1M

max_binlog_cache_size = 1M

max_binlog_size = 2M

expire_logs_days = 7

key_buffer_size = 16M

read_buffer_size = 1M

read_rnd_buffer_size = 1M

bulk_insert_buffer_size = 1M

#myisam_sort_buffer_size = 1M

#myisam_max_sort_file_size = 10G

#myisam_max_extra_sort_file_size = 10G

#myisam_repair_threads = 1

#myisam_recover


lower_case_table_names = 1

skip-name-resolve

slave-skip-errors = 1032,1062

replicate-ignore-db=mysql


server-id = 1


innodb_additional_mem_pool_size = 4M

innodb_buffer_pool_size = 32M

innodb_data_file_path = ibdata1:128M:autoextend

innodb_file_io_threads = 4

innodb_thread_concurrency = 8

innodb_flush_log_at_trx_commit = 2

innodb_log_buffer_size = 2M

innodb_log_file_size = 4M

innodb_log_files_in_group = 3

innodb_max_dirty_pages_pct = 90

innodb_lock_wait_timeout = 120

innodb_file_per_table = 0

[mysqldump]

quick

max_allowed_packet = 2M


[mysqld_safe]

log-error=/tmp/mysql_oldboy3306.err

##pid-file=/data/3306/mysqld.pid


保存退出,重新啟動:

[[email protected] data]# /etc/init.d/mysqld start

Starting MySQL. ERROR! The server quit without updating PID file (/u02/mysql-5.6.37/data/linux-mysql02.pid).

報錯!!!

查看錯誤日誌:

[[email protected] data]# vim /tmp/mysql_oldboy3306.err

2017-08-12 18:13:18 28414 [ERROR] InnoDB: auto-extending data file ./ibdata1 is of a different size 768 pages (rounded down to MB) than specified

in the .cnf file: initial 8192 pages, max 0 (relevant if non-zero) pages!

2017-08-12 18:13:18 28414 [ERROR] InnoDB: Could not open or create the system tablespace. If you tried to add new data files to the system tablesp

ace, and it failed here, you should now edit innodb_data_file_path in my.cnf back to what it was, and remove the new ibdata files InnoDB created i

n this failed attempt. InnoDB only wrote those files full of zeros, but did not yet use them in any way. But be careful: do not remove old data fi

les which contain your precious data!

2017-08-12 18:13:18 28414 [ERROR] Plugin ‘InnoDB‘ init function returned error.

2017-08-12 18:13:18 28414 [ERROR] Plugin ‘InnoDB‘ registration as a STORAGE ENGINE failed.

2017-08-12 18:13:18 28414 [ERROR] Unknown/unsupported storage engine: InnoDB

2017-08-12 18:13:18 28414 [ERROR] Aborting


1、原來的ibdata1大小為:768*16/1024=12M

2、當前ibdata1被修改為:8192*16/1024=128M

innodb_data_file_path = ibdata1:128M:autoextend

發現我現在的大小就是128M,這邊改為12M試試


[[email protected] data]# /etc/init.d/mysqld start

Starting MySQL.. SUCCESS!

成功啟動!!!


本文出自 “10732668” 博客,請務必保留此出處http://10742668.blog.51cto.com/10732668/1955798

mysql報錯