mysql频繁重新启动,大神帮忙看看

160831 16:32:10 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
160831 16:32:10 [Warning] '--skip-locking' is deprecated and will be removed in a future release. Please use '--skip-external-locking' instead.
160831 16:32:10 InnoDB: Initializing buffer pool, size = 8.0M
160831 16:32:10 InnoDB: Completed initialization of buffer pool
InnoDB: 1 transaction(s) which must be rolled back or cleaned up
InnoDB: in total 35 row operations to undo
InnoDB: Trx id counter is 0 112437760
160831 16:32:10 InnoDB: Started; log sequence number 1 255213035
InnoDB: Starting in background the rollback of uncommitted transactions
InnoDB: Cleaning up trx with id 0 2496008
160831 16:32:10 InnoDB: Rollback of non-prepared transactions completed
160831 16:32:10 [Note] Event Scheduler: Loaded 0 events
160831 16:32:10 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.1.73-log' socket: '/var/lib/mysql/mysql.sock' port: 3306 Source distribution
InnoDB: error in sec index entry update in
InnoDB: index history_uint_1 of table zabbix.history_uint
InnoDB: tuple DATA TUPLE: 3 fields;
0: len 8; hex 0000000000005fd2; asc _ ;; 1: len 4; hex d771e21f; asc q ;; 2: len 6; hex 000000219c60; asc ! `;;

InnoDB: record PHYSICAL RECORD: n_fields 3; compact format; info bits 32
0: len 8; hex 0000000000005fd2; asc _ ;; 1: len 4; hex d771e1e3; asc q ;; 2: len 6; hex 000000219a50; asc ! P;;

TRANSACTION 0 112437763, ACTIVE 0 sec, process no 17925, OS thread id 140519254370064 updating or deleting, thread declared inside InnoDB 497
mysql tables in use 1, locked 1
5 lock struct(s), heap size 1216, 5 row lock(s), undo log entries 2
MySQL thread id 4, query id 11 localhost zabbix updating
delete from history_uint where itemid=24530 and clock<1467095587

InnoDB: Submit a detailed bug report to http://bugs.mysql.com
InnoDB: error in sec index entry update in
InnoDB: index history_uint_1 of table zabbix.history_uint
InnoDB: tuple DATA TUPLE: 3 fields;
0: len 8; hex 0000000000005fd2; asc _ ;; 1: len 4; hex d771e25c; asc q \;; 2: len 6; hex 000000219e3e; asc ! >;;

InnoDB: record PHYSICAL RECORD: n_fields 3; compact format; info bits 32
0: len 8; hex 0000000000005fd2; asc _ ;; 1: len 4; hex d771e1e3; asc q ;; 2: len 6; hex 000000219a50; asc ! P;;

TRANSACTION 0 112437763, ACTIVE 0 sec, process no 17925, OS thread id 140519254370064 updating or deleting, thread declared inside InnoDB 495
mysql tables in use 1, locked 1
6 lock struct(s), heap size 1216, 7 row lock(s), undo log entries 3
MySQL thread id 4, query id 11 localhost zabbix updating
delete from history_uint where itemid=24530 and clock<1467095587

InnoDB: Submit a detailed bug report to http://bugs.mysql.com
InnoDB: error in sec index entry update in
InnoDB: index history_uint_1 of table zabbix.history_uint
InnoDB: tuple DATA TUPLE: 3 fields;
0: len 8; hex 0000000000005fd2; asc _ ;; 1: len 4; hex d771e297; asc q ;; 2: len 6; hex 000000219f65; asc ! e;;

InnoDB: record PHYSICAL RECORD: n_fields 3; compact format; info bits 32
0: len 8; hex 0000000000005fd2; asc _ ;; 1: len 4; hex d771e1e3; asc q ;; 2: len 6; hex 000000219a50; asc ! P;;

TRANSACTION 0 112437763, ACTIVE 0 sec, process no 17925, OS thread id 140519254370064 updating or deleting, thread declared inside InnoDB 493
mysql tables in use 1, locked 1
6 lock struct(s), heap size 1216, 9 row lock(s), undo log entries 4
MySQL thread id 4, query id 11 localhost zabbix updating
delete from history_uint where itemid=24530 and clock<1467095587

InnoDB: Submit a detailed bug report to http://bugs.mysql.com
InnoDB: error in sec index entry update in
InnoDB: index history_uint_1 of table zabbix.history_uint
InnoDB: tuple DATA TUPLE: 3 fields;
0: len 8; hex 0000000000005fd2; asc _ ;; 1: len 4; hex d771e2d3; asc q ;; 2: len 6; hex 00000021a125; asc ! %;;

InnoDB: record PHYSICAL RECORD: n_fields 3; compact format; info bits 32
0: len 8; hex 0000000000005fd2; asc _ ;; 1: len 4; hex d771e1e3; asc q ;; 2: len 6; hex 000000219a50; asc ! P;;

TRANSACTION 0 112437763, ACTIVE 0 sec, process no 17925, OS thread id 140519254370064 updating or deleting, thread declared inside InnoDB 491
mysql tables in use 1, locked 1
7 lock struct(s), heap size 1216, 11 row lock(s), undo log entries 5
MySQL thread id 4, query id 11 localhost zabbix updating
delete from history_uint where itemid=24530 and clock<1467095587

InnoDB: Submit a detailed bug report to http://bugs.mysql.com
InnoDB: error in sec index entry update in
InnoDB: index history_uint_1 of table zabbix.history_uint
InnoDB: tuple DATA TUPLE: 3 fields;
0: len 8; hex 0000000000005fd2; asc _ ;; 1: len 4; hex d771e310; asc q ;; 2: len 6; hex 00000021a31a; asc ! ;;

InnoDB: record PHYSICAL RECORD: n_fields 3; compact format; info bits 32
0: len 8; hex 0000000000005fd2; asc _ ;; 1: len 4; hex d771e1e3; asc q ;; 2: len 6; hex 000000219a50; asc ! P;;

你试试看看 进程书 show processlist; 看下最大连接数
设置下

show processlist;
+----+--------+-----------+--------+---------+------+-------+------------------+
| Id | User | Host | db | Command | Time | State | Info |
+----+--------+-----------+--------+---------+------+-------+------------------+
| 1 | zabbix | localhost | zabbix | Sleep | 6 | | NULL |
| 2 | root | localhost | NULL | Query | 0 | NULL | show processlist |
| 3 | zabbix | localhost | zabbix | Sleep | 4 | | NULL |
| 4 | zabbix | localhost | zabbix | Sleep | 2 | | NULL |
| 5 | zabbix | localhost | zabbix | Sleep | 1 | | NULL |
+----+--------+-----------+--------+---------+------+-------+------------------+
5 rows in set (0.00 sec)

mysql什么版本 ?你执行了什么操作 才导致 司机得

show processlist;里面 没有你得sql哇

Example MySQL config file for very large systems.

#

This is for a large system with memory of 1G-2G where the system runs mainly

MySQL.

#

MySQL programs look for option files in a set of

locations which depend on the deployment platform.

You can copy this option file to one of those

locations. For information about these locations, see:

http://dev.mysql.com/doc/mysql/en/option-files.html

#

In this file, you can use all long options that a program supports.

If you want to know which options a program supports, run the program

with the "--help" option.

The following options will be passed to all MySQL clients

[client]
#password = your_password
port = 3306
socket = /var/lib/mysql/mysql.sock

Here follows entries for some specific programs

The MySQL server

[mysqld]
port = 3306
socket = /var/lib/mysql/mysql.sock
skip-locking
key_buffer_size = 384M
max_allowed_packet = 1M
table_open_cache = 512
sort_buffer_size = 2M
read_buffer_size = 2M
read_rnd_buffer_size = 8M
myisam_sort_buffer_size = 64M
thread_cache_size = 8
query_cache_size = 32M

Try number of CPU's*2 for thread_concurrency

thread_concurrency = 8

Don't listen on a TCP/IP port at all. This can be a security enhancement,

if all processes that need to connect to mysqld run on the same host.

All interaction with mysqld must be made via Unix sockets or named pipes.

Note that using this option without enabling named pipes on Windows

(via the "enable-named-pipe" option) will render mysqld useless!

#skip-networking

Replication Master Server (default)

binary logging is required for replication

log-bin=mysql-bin

required unique id between 1 and 2^32 - 1

defaults to 1 if master-host is not set

but will not function as a master if omitted

server-id = 1

Replication Slave (comment out master section to use this)

#

To configure this host as a replication slave, you can choose between

two methods :

#

1) Use the CHANGE MASTER TO command (fully described in our manual) -

the syntax is:

#

CHANGE MASTER TO MASTER_HOST=, MASTER_PORT=,

MASTER_USER=, MASTER_PASSWORD= ;

#

where you replace , , by quoted strings and

by the master's port number (3306 by default).

#

Example:

#

CHANGE MASTER TO MASTER_HOST='125.564.12.1', MASTER_PORT=3306,

MASTER_USER='joe', MASTER_PASSWORD='secret';

#

OR

#

2) Set the variables below. However, in case you choose this method, then

start replication for the first time (even unsuccessfully, for example

if you mistyped the password in master-password and the slave fails to

connect), the slave will create a master.info file, and any later

change in this file to the variables' values below will be ignored and

overridden by the content of the master.info file, unless you shutdown

the slave server, delete master.info and restart the slaver server.

For that reason, you may want to leave the lines below untouched

(commented) and instead use CHANGE MASTER TO (see above)

#

required unique id between 2 and 2^32 - 1

(and different from the master)

defaults to 2 if master-host is set

but will not function as a slave if omitted

#server-id = 2
#

The replication master for this slave - required

#master-host =
#

The username the slave will use for authentication when connecting

to the master - required

#master-user =
#

The password the slave will authenticate with when connecting to

the master - required

#master-password =
#

The port the master is listening on.

optional - defaults to 3306

#master-port =
#

binary logging - not required for slaves, but recommended

#log-bin=mysql-bin
#

binary logging format - mixed recommended

#binlog_format=mixed

Uncomment the following if you are using InnoDB tables

#innodb_data_home_dir = /var/lib/mysql
#innodb_data_file_path = ibdata1:2000M;ibdata2:10M:autoextend
#innodb_log_group_home_dir = /var/lib/mysql

You can set .._buffer_pool_size up to 50 - 80 %

of RAM but beware of setting memory usage too high

#innodb_buffer_pool_size = 384M
#innodb_additional_mem_pool_size = 20M

Set .._log_file_size to 25 % of buffer pool size

#innodb_log_file_size = 100M
#innodb_log_buffer_size = 8M
#innodb_flush_log_at_trx_commit = 1
#innodb_lock_wait_timeout = 50

[mysqldump]
quick
max_allowed_packet = 16M

[mysql]
no-auto-rehash

Remove the next comment character if you are not familiar with SQL

#safe-updates

[myisamchk]
key_buffer_size = 256M
sort_buffer_size = 256M
read_buffer = 2M
write_buffer = 2M

[mysqlhotcopy]
interactive-timeout

+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_connections | 151 |
+-----------------+-------+
1 row in set (0.00 sec)

你看下 cpu 和内存 是不是 内其他得程序 占满了

mysql有打印log得 你给我看下 最近 得日志

一般系统 异常 mysql自动会保存到 系统得日志里面

free -m -s 5

是errorlog吗?

my.cnf 有个好像叫 --log-error这个得 你看看

我估计是 你其他程序吧 内存占用了 mysqld就没法 执行 卡住了 就一直重启 然后你得程序 还一直 占着内存。 看下磁盘 够不够大 一般 你得磁盘 用了一般都额时候 mysqld 查询 就开始卡了

duanzhi789 [root@localhost mysql]# free -m -s -5 total used free shared buffers cached Mem: 2081 1324 756 0 24 881 -/+ buffers/cache: 418 1663 Swap: 1503 0 1503

你别在 mysql里面 用free呀

退出去 在看

key_buffer_size=402653184
read_buffer_size=2097152
max_used_connections=0
max_threads=151
thread_count=0
connection_count=0
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 1013285 K bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

Thread pointer: 0x0
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 0 thread_stack 0x40000
/usr/libexec/mysqld(my_print_stacktrace+0x29) [0x8509b9]
/usr/libexec/mysqld(handle_fatal_signal+0x483) [0x6a3ef3]
/lib64/libpthread.so.0(+0xf4c0) [0x7f6694c144c0]
/lib64/libc.so.6(gsignal+0x35) [0x7f669325e9a5]
/lib64/libc.so.6(abort+0x175) [0x7f6693260185]
/usr/libexec/mysqld(fseg_free_step_not_header+0x1e8) [0x770ba8]
/usr/libexec/mysqld() [0x7cdfe2]
/usr/libexec/mysqld() [0x7ce3c7]
/usr/libexec/mysqld(trx_purge_fetch_next_rec+0x3ff) [0x7ce88f]
/usr/libexec/mysqld(row_purge_step+0x40) [0x7b3290]
/usr/libexec/mysqld(que_run_threads+0x55b) [0x7a253b]
/usr/libexec/mysqld(trx_purge+0x332) [0x7cc8e2]
/usr/libexec/mysqld(srv_master_thread+0x708) [0x7c5278]
/lib64/libpthread.so.0(+0x77e1) [0x7f6694c0c7e1]
/lib64/libc.so.6(clone+0x6d) [0x7f669330d52d]
The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
information that should help you find out what is causing the crash.
160831 17:42:55 mysqld_safe Number of processes running now: 0
160831 17:42:55 mysqld_safe mysqld restarted
160831 17:42:55 [Warning] '--skip-locking' is deprecated and will be removed in a future release. Please use '--skip-external-locking' instead.
160831 17:42:55 InnoDB: Initializing buffer pool, size = 8.0M
160831 17:42:55 InnoDB: Completed initialization of buffer pool
InnoDB: Log scan progressed past the checkpoint lsn 1 260216548
160831 17:42:55 InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
InnoDB: Doing recovery: scanned up to log sequence number 1 260831580
InnoDB: 1 transaction(s) which must be rolled back or cleaned up
InnoDB: in total 35 row operations to undo
InnoDB: Trx id counter is 0 112622848
160831 17:42:55 InnoDB: Starting an apply batch of log records to the database...
InnoDB: Progress in percents: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
InnoDB: Apply batch completed
InnoDB: Last MySQL binlog file position 0 1780, file name ./mysql-bin.000564
160831 17:42:57 InnoDB: Started; log sequence number 1 260831580
160831 17:42:57 [Note] Recovering after a crash using mysql-bin
160831 17:42:57 [Note] Starting crash recovery...
160831 17:42:57 [Note] Crash recovery finished.
InnoDB: Starting in background the rollback of uncommitted transactions
InnoDB: Cleaning up trx with id 0 2496008
160831 17:42:57 InnoDB: Rollback of non-prepared transactions completed
160831 17:42:57 [Note] Event Scheduler: Loaded 0 events
160831 17:42:57 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.1.73-log' socket: '/var/lib/mysql/mysql.sock' port: 3306 Source distribution
160831 17:42:58 InnoDB: Assertion failure in thread 140022486722320 in file fsp/fsp0fsp.c line 3341
InnoDB: We intentionally generate a memory trap.
InnoDB: Submit a detailed bug report to http://bugs.mysql.com.
InnoDB: If you get repeated assertion failures or crashes, even
InnoDB: immediately after the mysqld startup, there may be
InnoDB: corruption in the InnoDB tablespace. Please refer to
InnoDB: http://dev.mysql.com/doc/refman/5.1/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.
09:42:58 UTC - mysqld got signal 6 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
We will try our best to scrape up some info that will hopefully help
diagnose the problem, but since we have already crashed,
something is definitely wrong and this may fail.

你看日志里面有没有 error 。。。这个报错得内容 实在不行 你就重装mysql 反正 也很快

把报错得 日志 带异常得内容 贴出来