[MySQL FAQ]系列 -- 新手必看:一步到位之InnoDB

本文详细解析了InnoDB引擎的核心特性和优势,提供了优化配置的实用技巧,帮助开发者快速掌握并高效利用InnoDB,提升数据库性能。

作/译者:叶金荣(imysql#imysql.com>),来源:http://imysql.com,欢迎转载。

前言:MySQL发展到今天,InnoDB引擎已经作为绝对的主力,除了像大数据量分析等比较特殊领域需求外,它适用于众多场景。然而,仍有不少开发者还在“执迷不悟”的使用MyISAM引擎,觉得对InnoDB无法把握好,还是MyISAM简单省事,还能支持快速COUNT(*)。本文是由于最近几天帮忙处理discuz论坛有感而发,希望能对广大开发者有帮助。

1. 快速认识InnoDB
InnoDB是MySQL下使用最广泛的引擎,它是基于MySQL的高可扩展性和高性能存储引擎,从5.5版本开始,它已经成为了默认引擎。
InnODB引擎支持众多特性:

a) 支持ACID,简单地说就是支持事务完整性、一致性; 
b) 支持行锁,以及类似ORACLE的一致性读,多用户并发;
c) 独有的聚集索引主键设计方式,可大幅提升并发读写性能;
d) 支持外键;
e) 支持崩溃数据自修复;

InnoDB有这么多特性,比MyISAM来的优秀多了,还犹豫什么,果断的切换到InnoDB引擎吧 :)

2. 修改InnoDB配置选项
可以选择官方版本,或者Percona的分支,如果不知道在哪下载,就google吧。
安装完MySQL后,需要适当修改下my.cnf配置文件,针对InnoDB相关的选项做一些调整,才能较好的运行InnoDB。
相关的选项有:

#InnoDB存储数据字典、内部数据结构的缓冲池,16MB 已经足够大了。
innodb_additional_mem_pool_size = 16M

#InnoDB用于缓存数据、索引、锁、插入缓冲、数据字典等
#如果是专用的DB服务器,且以InnoDB引擎为主的场景,通常可设置物理内存的50%
#如果是非专用DB服务器,可以先尝试设置成内存的1/4,如果有问题再调整
#默认值是8M,非常坑X,这也是导致很多人觉得InnoDB不如MyISAM好用的缘故
innodb_buffer_pool_size = 4G

#InnoDB共享表空间初始化大小,默认是 10MB,也非常坑X,改成 1GB,并且自动扩展
innodb_data_file_path = ibdata1:1G:autoextend

#如果不了解本选项,建议设置为1,能较好保护数据可靠性,对性能有一定影响,但可控
innodb_flush_log_at_trx_commit = 1

#InnoDB的log buffer,通常设置为 64MB 就足够了
innodb_log_buffer_size = 64M

#InnoDB redo log大小,通常设置256MB 就足够了
innodb_log_file_size = 256M

#InnoDB redo log文件组,通常设置为 2 就足够了
innodb_log_files_in_group = 2

#启用InnoDB的独立表空间模式,便于管理
innodb_file_per_table = 1

#启用InnoDB的status file,便于管理员查看以及监控等
innodb_status_file = 1

#设置事务隔离级别为 READ-COMMITED,提高事务效率,通常都满足事务一致性要求
transaction_isolation = READ-COMMITTED 

在这里,其他配置选项也需要注意:

#设置最大并发连接数,如果前端程序是PHP,可适当加大,但不可过大
#如果前端程序采用连接池,可适当调小,避免连接数过大
max_connections = 60

#最大连接错误次数,可适当加大,防止频繁连接错误后,前端host被mysql拒绝掉
max_connect_errors = 100000

#设置慢查询阀值,建议设置最小的 1 秒
long_query_time = 1

#设置临时表最大值,这是每次连接都会分配,不宜设置过大 max_heap_table_size 和 tmp_table_size 要设置一样大
max_heap_table_size = 96M
tmp_table_size = 96M

#每个连接都会分配的一些排序、连接等缓冲,一般设置为 2MB 就足够了
sort_buffer_size = 2M
join_buffer_size = 2M
read_buffer_size = 2M
read_rnd_buffer_size = 2M

#建议关闭query cache,有些时候对性能反而是一种损害
query_cache_size = 0

#如果是以InnoDB引擎为主的DB,专用于MyISAM引擎的 key_buffer_size 可以设置较小,8MB 已足够
#如果是以MyISAM引擎为主,可设置较大,但不能超过4G
#在这里,强烈建议不使用MyISAM引擎,默认都是用InnoDB引擎
key_buffer_size = 8M

#设置连接超时阀值,如果前端程序采用短连接,建议缩短这2个值
#如果前端程序采用长连接,可直接注释掉这两个选项,是用默认配置(8小时)
interactive_timeout = 120
wait_timeout = 120

3. 开始使用InnoDB引擎
修改完配置文件,即可启动MySQL。启动完毕后,在MySQL的datadir目录下,若产生以下几个文件,则表示应该可以使用InnoDB引擎了。

-rw-rw---- 1 mysql mysql 1.0G Sep 21 17:25 ibdata1
-rw-rw---- 1 mysql mysql 256M Sep 21 17:25 ib_logfile0
-rw-rw---- 1 mysql mysql 256M Sep 21 10:50 ib_logfile1

登录MySQL后,执行命令,确认已启用InnoDB引擎:

(root:imysql.cn:Thu Oct 15 09:16:22 2009)[mysql]> show engines;
+------------+---------+----------------------------------------------------------------+--------------+------+------------+
| Engine     | Support | Comment                                                        | Transactions | XA   | Savepoints |
+------------+---------+----------------------------------------------------------------+--------------+------+------------+
| InnoDB     | YES     | Supports transactions, row-level locking, and foreign keys     | YES          | YES  | YES        |

接下来创建一个InnoDB表:

(root:imysql.cn:Thu Oct 15 09:16:22 2009)[mysql]> 
CREATE TABLE my_innodb_talbe(
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
name VARCHAR(20) NOT NULL DEFAULT '',
passwd VARCHAR(32) NOT NULL DEFAULT '',
PRIMARY KEY(id),
UNIQUE KEY `idx_name`(name)
) ENGINE = InnoDB;

有几个和MySQL(尤其是InnoDB引擎)数据表设计相关的建议,希望开发者朋友能遵循:

a) 所有InnoDB数据表都创建一个和业务无关的自增数字型作为主键,对保证性能很有帮助;
b) 杜绝使用text/blob,确实需要使用的,尽可能拆分出去成一个独立的表;
c) 时间戳建议使用 TIMESTAMP 类型存储;
d) IPV4 地址建议用 INT UNSIGNED 类型存储;
e) 性别等非是即非的逻辑,建议采用 TINYINT 存储,而不是 CHAR(1);
f) 存储较长文本内容时,建议采用JSON/BSON格式存储;
[root@master mysql]# [root@master mysql]# cat /export/server/mysql/data/error.log 2025-10-23T01:13:55.414279Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2025-10-23T01:13:55.414408Z 0 [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled 2025-10-23T01:13:55.414450Z 0 [Note] /export/server/mysql/bin/mysqld (mysqld 5.7.43) starting as process 75223 ... 2025-10-23T01:13:55.420835Z 0 [Note] InnoDB: PUNCH HOLE support available 2025-10-23T01:13:55.420908Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 2025-10-23T01:13:55.420916Z 0 [Note] InnoDB: Uses event mutexes 2025-10-23T01:13:55.420919Z 0 [Note] InnoDB: GCC builtin __sync_synchronize() is used for memory barrier 2025-10-23T01:13:55.420922Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.13 2025-10-23T01:13:55.420925Z 0 [Note] InnoDB: Using Linux native AIO 2025-10-23T01:13:55.421185Z 0 [Note] InnoDB: Number of pools: 1 2025-10-23T01:13:55.421275Z 0 [Note] InnoDB: Using CPU crc32 instructions 2025-10-23T01:13:55.435005Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M 2025-10-23T01:13:55.444667Z 0 [Note] InnoDB: Completed initialization of buffer pool 2025-10-23T01:13:55.450205Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority(). 2025-10-23T01:13:55.463031Z 0 [Note] InnoDB: Highest supported file format is Barracuda. 2025-10-23T01:13:55.473691Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables 2025-10-23T01:13:55.473830Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ... 2025-10-23T01:13:55.495089Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB. 2025-10-23T01:13:55.495883Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active. 2025-10-23T01:13:55.496011Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active. 2025-10-23T01:13:55.496616Z 0 [Note] InnoDB: Waiting for purge to start 2025-10-23T01:13:55.547361Z 0 [Note] InnoDB: 5.7.43 started; log sequence number 2766921 2025-10-23T01:13:55.549046Z 0 [Note] InnoDB: Loading buffer pool(s) from /export/server/mysql/data/ib_buffer_pool 2025-10-23T01:13:55.549951Z 0 [Note] Plugin 'FEDERATED' is disabled. 2025-10-23T01:13:55.551197Z 0 [Note] InnoDB: Buffer pool(s) load completed at 251023 9:13:55 2025-10-23T01:13:55.556296Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them. 2025-10-23T01:13:55.556312Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory. 2025-10-23T01:13:55.556317Z 0 [Warning] A deprecated TLS version TLSv1 is enabled. Please use TLSv1.2 or higher. 2025-10-23T01:13:55.556320Z 0 [Warning] A deprecated TLS version TLSv1.1 is enabled. Please use TLSv1.2 or higher. 2025-10-23T01:13:55.560623Z 0 [Warning] CA certificate ca.pem is self signed. 2025-10-23T01:13:55.560676Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory. 2025-10-23T01:13:55.561456Z 0 [Note] Server hostname (bind-address): '*'; port: 3306 2025-10-23T01:13:55.561525Z 0 [Note] IPv6 is available. 2025-10-23T01:13:55.561533Z 0 [Note] - '::' resolves to '::'; 2025-10-23T01:13:55.561553Z 0 [Note] Server socket created on IP: '::'. 2025-10-23T01:13:55.572947Z 0 [Note] Event Scheduler: Loaded 0 events 2025-10-23T01:13:55.573171Z 0 [Note] /export/server/mysql/bin/mysqld: ready for connections. Version: '5.7.43' socket: '/tmp/mysql.sock' port: 3306 MySQL Community Server (GPL) 2025-10-23T01:14:34.896537Z 2 [Note] Access denied for user 'root'@'localhost' (using password: YES) 2025-10-23T01:38:33.169627Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2025-10-23T01:38:33.169753Z 0 [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled 2025-10-23T01:38:33.169798Z 0 [Note] /export/server/mysql/bin/mysqld (mysqld 5.7.43) starting as process 118444 ... 2025-10-23T01:38:33.177313Z 0 [Note] InnoDB: PUNCH HOLE support available 2025-10-23T01:38:33.177351Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 2025-10-23T01:38:33.177357Z 0 [Note] InnoDB: Uses event mutexes 2025-10-23T01:38:33.177361Z 0 [Note] InnoDB: GCC builtin __sync_synchronize() is used for memory barrier 2025-10-23T01:38:33.177364Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.13 2025-10-23T01:38:33.177367Z 0 [Note] InnoDB: Using Linux native AIO 2025-10-23T01:38:33.177700Z 0 [Note] InnoDB: Number of pools: 1 2025-10-23T01:38:33.178030Z 0 [Note] InnoDB: Using CPU crc32 instructions 2025-10-23T01:38:33.182715Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M 2025-10-23T01:38:33.192178Z 0 [Note] InnoDB: Completed initialization of buffer pool 2025-10-23T01:38:33.194675Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority(). 2025-10-23T01:38:33.204980Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:38:33.205030Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:38:33.205040Z 0 [Note] InnoDB: Retrying to lock the first data file 2025-10-23T01:38:34.206008Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:38:34.206060Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:38:35.206300Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:38:35.206348Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:38:36.206929Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:38:36.206965Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:38:37.207044Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:38:37.207082Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:38:38.207378Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:38:38.207423Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:38:39.207891Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:38:39.207968Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:38:40.208356Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:38:40.208493Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:38:41.209159Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:38:41.209210Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:38:42.209436Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:38:42.209466Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:38:43.222502Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:38:43.222576Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:38:44.223360Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:38:44.223423Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:38:45.223766Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:38:45.223802Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:38:46.224017Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:38:46.224080Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:38:47.224624Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:38:47.224687Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:38:48.224825Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:38:48.224865Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:38:49.225531Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:38:49.225584Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:38:50.225762Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:38:50.225826Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:38:51.226964Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:38:51.227011Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:38:52.227384Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:38:52.227425Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:38:53.227939Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:38:53.227989Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:38:54.228400Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:38:54.228452Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:38:55.228603Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:38:55.228636Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:38:56.229104Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:38:56.229169Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:38:57.229819Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:38:57.229876Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:38:58.230309Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:38:58.230365Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:38:59.230752Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:38:59.230806Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:39:00.231287Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:39:00.231348Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:39:01.232308Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:39:01.232384Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:39:02.232711Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:39:02.232767Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:39:03.233423Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:39:03.233489Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:39:04.233976Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:39:04.234016Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:39:05.234460Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:39:05.234513Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:39:06.234802Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:39:06.234869Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:39:07.235875Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:39:07.235955Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:39:08.236527Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:39:08.236589Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:39:09.237178Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:39:09.237244Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:39:10.237935Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:39:10.238204Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:39:11.238609Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:39:11.238711Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:39:12.239379Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:39:12.239434Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:39:13.239799Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:39:13.239851Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:39:14.240048Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:39:14.240108Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:39:15.240305Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:39:15.240360Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:39:16.240582Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:39:16.240638Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:39:17.241380Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:39:17.241418Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:39:18.242303Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:39:18.242439Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:39:19.243096Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:39:19.243153Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:39:20.243484Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:39:20.243556Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:39:21.243759Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:39:21.243809Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:39:22.244131Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:39:22.244186Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:39:23.244922Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:39:23.245052Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:39:24.246341Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:39:24.246388Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:39:25.246626Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:39:25.246675Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:39:26.247096Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:39:26.248258Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:39:27.248681Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:39:27.248748Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:39:28.249386Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:39:28.249439Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:39:29.249626Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:39:29.249667Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:39:30.249910Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:39:30.249963Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:39:31.251042Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:39:31.251083Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:39:32.251255Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:39:32.251299Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:39:33.251726Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:39:33.251777Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:39:34.251973Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:39:34.252030Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:39:35.252544Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:39:35.252592Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:39:36.252876Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:39:36.252931Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:39:37.253711Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:39:37.253768Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:39:38.253946Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:39:38.253991Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:39:39.254333Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:39:39.254390Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:39:40.254700Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:39:40.254765Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:39:41.255174Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:39:41.255238Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:39:42.255552Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:39:42.255628Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:39:43.256063Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:39:43.256124Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:39:44.256363Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:39:44.256418Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:39:45.257169Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:39:45.257245Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:39:46.257802Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:39:46.257874Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:39:47.258303Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:39:47.258358Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:39:48.258913Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:39:48.258968Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:39:49.259298Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:39:49.259355Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:39:50.259563Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:39:50.259631Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:39:51.259846Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:39:51.259902Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:39:52.260069Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:39:52.260123Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:39:53.260689Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:39:53.260743Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:39:54.261138Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:39:54.261195Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:39:55.261401Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:39:55.261458Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:39:56.261669Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:39:56.261722Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:39:57.262101Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:39:57.262154Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:39:58.262590Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:39:58.262646Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:39:59.263205Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:39:59.263261Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:40:00.263719Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:40:00.263776Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:40:01.263992Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:40:01.264027Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:40:02.264200Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:40:02.264249Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:40:03.264605Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:40:03.264675Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:40:04.265198Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:40:04.265244Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:40:05.265605Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:40:05.265713Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:40:06.265930Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:40:06.265987Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:40:07.266540Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:40:07.266604Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:40:08.267198Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:40:08.267254Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:40:09.267931Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:40:09.268002Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:40:10.268330Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:40:10.268373Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:40:11.268930Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:40:11.268982Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:40:12.269604Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:40:12.269658Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:40:13.269932Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 2025-10-23T01:40:13.269980Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. 2025-10-23T01:40:13.269985Z 0 [Note] InnoDB: Unable to open the first data file 2025-10-23T01:40:13.270007Z 0 [ERROR] InnoDB: Operating system error number 11 in a file operation. 2025-10-23T01:40:13.270028Z 0 [ERROR] InnoDB: Error number 11 means 'Resource temporarily unavailable' 2025-10-23T01:40:13.270034Z 0 [Note] InnoDB: Some operating system error numbers are described at http://dev.mysql.com/doc/refman/5.7/en/operating-system-error-codes.html 2025-10-23T01:40:13.270038Z 0 [ERROR] InnoDB: Cannot open datafile './ibdata1' 2025-10-23T01:40:13.270045Z 0 [ERROR] InnoDB: Could not open or create the system tablespace. If you tried to add new data files to the system tablespace, 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 in 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 files which contain your precious data! 2025-10-23T01:40:13.270059Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Cannot open a file 2025-10-23T01:40:13.470950Z 0 [ERROR] Plugin 'InnoDB' init function returned error. 2025-10-23T01:40:13.470999Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed. 2025-10-23T01:40:13.471006Z 0 [ERROR] Failed to initialize builtin plugins. 2025-10-23T01:40:13.471008Z 0 [ERROR] Aborting 2025-10-23T01:40:13.471026Z 0 [Note] Binlog end 2025-10-23T01:40:13.471098Z 0 [Note] Shutting down plugin 'MyISAM' 2025-10-23T01:40:13.471480Z 0 [Note] /export/server/mysql/bin/mysqld: Shutdown complete [root@master mysql]#
最新发布
10-24
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值