正如标题所示,我正在尝试使用 Ansible 在 Debian 上安装 MySQL Server 5.5。
由于这需要静默安装,因此我在安装前使用 debconf 模块提供了 root 密码。以下是此操作的输出:
changed: [nqdo-net] => (item={'value': {'type': 'password', 'name': 'mysql-server/root_password', 'value': u'XXXXthisismyrandomandlongpasswordXXXX'}, 'key': 'root_password'})
changed: [nqdo-net] => (item={'value': {'type': 'password', 'name': 'mysql-server/root_password_again', 'value': u'XXXXthisismyrandomandlongpasswordXXXX'}, 'key': 'root_password_again'})
我编写了一个角色来像这样安装 Tripwire,它运行良好。但不幸的是,MySQL 安装失败并显示以下消息:
140901 21:24:55 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.
140901 21:24:55 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.
140901 21:24:55 [Note] Plugin 'FEDERATED' is disabled.
140901 21:24:55 InnoDB: The InnoDB memory heap is disabled
140901 21:24:55 InnoDB: Mutexes and rw_locks use GCC atomic builtins
140901 21:24:55 InnoDB: Compressed tables use zlib 1.2.7
140901 21:24:55 InnoDB: Using Linux native AIO
140901 21:24:55 InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137363456 bytes) failed; errno 12
140901 21:24:55 InnoDB: Completed initialization of buffer pool
140901 21:24:55 InnoDB: Fatal error: cannot allocate memory for the buffer pool
140901 21:24:55 [ERROR] Plugin 'InnoDB' init function returned error.
140901 21:24:55 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
140901 21:24:55 [ERROR] Unknown/unsupported storage engine: InnoDB
140901 21:24:55 [ERROR] Aborting
140901 21:24:55 [Note] /usr/sbin/mysqld: Shutdown complete
Configuring mysql-server-5.5
----------------------------
Unable to set password for the MySQL "root" user
An error occurred while setting the password for the MySQL administrative user. This may have happened because the account already has a password, or because of a communication problem with the MySQL server.
You should check the account's password after the package installation.
Please read the /usr/share/doc/mysql-server-5.5/README.Debian file for more
information.
insserv: warning: script 'K01confluence' missing LSB tags and overrides
insserv: warning: script 'confluence' missing LSB tags and overrides
[FAIL] Starting MySQL database server: mysqld . . . . . . . . . . . . . . failed
!
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing mysql-server-5.5 (--configure):
subprocess installed post-installation script returned error exit status 1
msg: 'apt-get install 'mysql-server-5.5' ' failed: E: Sub-process /usr/bin/dpkg
returned an error code (1)
有什么办法可以解决这个问题吗?
提前致谢!
笔记:如果您投了反对票,至少告诉我原因!
答案1
这是您的问题:
InnoDB: mmap(137363456 bytes) failed; errno 12
该 errno 表示您在 MySQL 尝试启动时内存不足。请减少 MySQL 使用的内存量,或为机器提供更多 RAM。