更改配置后 MySQL 服务器无法启动

更改配置后 MySQL 服务器无法启动

我在 AWS EC2 微型实例上安装了 MySQL 服务器。服务器可以正常启动/停止,sudo 服务 mysql 启动/停止,但是由于我对配置文件做了一些小改动(更改了端口值并注释掉了绑定地址行),它就停止工作了。

现在当我这样做sudo 服务 mysql 启动它说启动:作业启动失败

我也尝试过执行 sudo mysqld --port xx 但仍然不起作用。

我对这个领域还很陌生,所以任何帮助都将非常有帮助。

编辑:这是配置

[client]
port            = xx
socket          = /var/run/mysqld/mysqld.sock

[mysqld_safe]
socket          = /var/run/mysqld/mysqld.sock
nice            = 0

[mysqld]
#
# * Basic Settings
#
user            = mysql
pid-file        = /var/run/mysqld/mysqld.pid
socket          = /var/run/mysqld/mysqld.sock
port            = xx
basedir         = /usr
datadir         = /var/lib/mysql
tmpdir          = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking

# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address            = (local ip address)

#
# * Fine Tuning
#
key_buffer              = 16M
max_allowed_packet      = 16M
thread_stack            = 192K
thread_cache_size       = 8
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover         = BACKUP
#max_connections        = 100
#table_cache            = 64
#thread_concurrency     = 10
#
# * Query Cache Configuration
#
query_cache_limit       = 1M
query_cache_size        = 16M
#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
# As of 5.1 you can enable the log at runtime!
#general_log_file        = /var/log/mysql/mysql.log
#general_log             = 1
#
# Error log - should be very few entries.
#
log_error = /var/log/mysql/error.log

由于这只是默认设置,因此我不会发布更多配置

错误(vim /var/log/mysql/error.log):

140811 20:20:29 [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.
140811 20:20:29 [Note] Plugin 'FEDERATED' is disabled.
140811 20:20:29 InnoDB: The InnoDB memory heap is disabled
140811 20:20:29 InnoDB: Mutexes and rw_locks use GCC atomic builtins
140811 20:20:29 InnoDB: Compressed tables use zlib 1.2.8
140811 20:20:29 InnoDB: Using Linux native AIO
140811 20:20:29 InnoDB: Initializing buffer pool, size = 128.0M
140811 20:20:29 InnoDB: Completed initialization of buffer pool
InnoDB: The first specified data file ./ibdata1 did not exist:
InnoDB: a new database to be created!
140811 20:20:29  InnoDB: Setting file ./ibdata1 size to 10 MB
InnoDB: Database physically writes the file full: wait...
140811 20:20:30  InnoDB: Log file ./ib_logfile0 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile0 size to 5 MB
InnoDB: Database physically writes the file full: wait...
140811 20:20:31  InnoDB: Log file ./ib_logfile1 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile1 size to 5 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: Doublewrite buffer not found: creating new
InnoDB: Doublewrite buffer created
InnoDB: 127 rollback segment(s) active.
InnoDB: Creating foreign key constraint system tables
InnoDB: Foreign key constraint system tables created
140811 20:20:32  InnoDB: Waiting for the background threads to start
140811 20:20:33 InnoDB: 5.5.38 started; log sequence number 0
140811 20:20:34  InnoDB: Starting shutdown...
140811 20:20:35  InnoDB: Shutdown completed; log sequence number 1595675
140811 20:20:36 [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.
140811 20:20:36 [Note] Plugin 'FEDERATED' is disabled.
140811 20:20:36 InnoDB: The InnoDB memory heap is disabled
140811 20:20:36 InnoDB: Mutexes and rw_locks use GCC atomic builtins
140811 20:20:36 InnoDB: Compressed tables use zlib 1.2.8
140811 20:20:36 InnoDB: Using Linux native AIO
140811 20:20:36 InnoDB: Initializing buffer pool, size = 128.0M
140811 20:20:36 InnoDB: Completed initialization of buffer pool
140811 20:20:36 InnoDB: highest supported file format is Barracuda.
140811 20:20:36  InnoDB: Waiting for the background threads to start
140811 20:20:37 InnoDB: 5.5.38 started; log sequence number 1595675
140811 20:20:38  InnoDB: Starting shutdown...
140811 20:20:39  InnoDB: Shutdown completed; log sequence number 1595675

更多错误:(dmesg | grep -i mysql)

... (pattern repeating)
[8847299.168709] init: mysql main process (1199) terminated with status 1
[8847299.168739] init: mysql main process ended, respawning
[8847299.246279] init: mysql post-start process (1200) terminated with status 1
[8847299.270609] type=1400 audit(1407875066.958:80): apparmor="STATUS" operation="profile_replace" profile="unconfined" name="/usr/sbin/mysqld" pid=1246 comm="apparmor_parser"
[8847301.287139] init: mysql main process (1258) terminated with status 1
[8847301.287169] init: mysql respawning too fast, stopped

关于绑定地址:我不确定应该将绑定地址设置为什么。将其设置为 0.0.0.0 对 mongodb 有效,但从我在这里看到的情况来看,我不应该这样做?这仅用于性能测试,因此我不需要担心安全性。

更多编辑:当我更改配置文件上的端口值时,它再次起作用,但遗憾的是我被迫使用特定的端口。

最终编辑:

我花了大约 7 个小时尝试修复此问题,但最终还是失败了。我要求老板开放端口 3306,然后改用该端口。

相关内容