mysql报错

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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报错的主要内容,如果未能解决你的问题,请参考以下文章

Django mysql 问题。。。报错如下

MySQL--18 报错总结

mysql自身报错javareids连接mysql数据库报错汇总

mysql5.7.12报错如下情况导致无法连接数据库应该怎么办?

pip安装mysql_python报错

Mac 下mysql 登录报错ERROR 1045 (28000)