我的 Mysql 服务器经常崩溃,我需要使用“service mysqld start”命令重新启动 mysql。我检查了mysql错误日志文件。
130807 22:59:47 mysqld_safe Number of processes running now: 0
130807 22:59:47 mysqld_safe mysqld restarted
130807 22:59:47 [Note] Plugin 'FEDERATED' is disabled.
130807 22:59:47 InnoDB: The InnoDB memory heap is disabled
130807 22:59:47 InnoDB: Mutexes and rw_locks use GCC atomic builtins
130807 22:59:47 InnoDB: Compressed tables use zlib 1.2.5
130807 22:59:47 InnoDB: Using Linux native AIO
130807 22:59:47 InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137363456 bytes) failed; errno 12
130807 22:59:47 InnoDB: Completed initialization of buffer pool
130807 22:59:47 InnoDB: Fatal error: cannot allocate memory for the buffer pool
130807 22:59:47 [ERROR] Plugin 'InnoDB' init function returned error.
130807 22:59:47 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
130807 22:59:47 [ERROR] Unknown/unsupported storage engine: InnoDB
130807 22:59:47 [ERROR] Aborting
130807 22:59:47 [Note] /usr/libexec/mysqld: Shutdown complete
130807 22:59:47 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
我有大约 10,000 个用户,并且我有一个包含 10,000 个表的数据库。这些表用于记录用户状态。而且,当我创建一个新的用户表时,我将以下代码与 PDO 一起使用。
$statusTable = "status_".$uid;
$qstr = "CREATE TABLE IF NOT EXISTS `status`.`$statusTable` (
`prim_id` INT( 5 ) NOT NULL AUTO_INCREMENT PRIMARY KEY,
`message` VARCHAR( 600 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`created_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE = INNODB";
$db->query($qstr);
这段代码会导致mysql崩溃吗?我使用 615MB 内存的 EC2 实例。谢谢!!