我修改了 my.cnf 文件,在其中添加了一些参数,但重新启动服务后,它无法启动并出现锁定错误。我使用 rm 命令删除了锁,并再次尝试重新启动,但它无法启动
我还将其更新到 my.cnf 备份文件。当我检查服务状态并尝试重新启动它时,出现以下消息。
# service mysql Status
MySQL is not running, but lock exists [FAILED]
# service mysql restart
MySQL manager or server PID file could not be found! [FAILED]
我 Centos 5.3 服务器和 mysql 5.3 社区版
谢谢,
掌握
这是错误日志文件:
110702 06:00:50 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
110702 6:00:50 [Note] Plugin 'FEDERATED' is disabled.
110702 6:00:50 InnoDB: Initializing buffer pool, size = 8.0M
110702 6:00:50 InnoDB: Completed initialization of buffer pool
InnoDB: The first specified data file ./ibdata1 did not exist:
InnoDB: a new database to be created!
110702 6:00:50 InnoDB: Setting file ./ibdata1 size to 10 MB
InnoDB: Database physically writes the file full: wait...
110702 6:00:50 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...
110702 6:00:50 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: Creating foreign key constraint system tables
InnoDB: Foreign key constraint system tables created
110702 6:00:50 InnoDB: Started; log sequence number 0 0
110702 6:00:50 [Note] Event Scheduler: Loaded 0 events
110702 6:00:50 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.1.56' socket: '/var/lib/mysql/mysql.sock' port: 3306 MySQL Community Server (GPL)
Status information:
Current dir: /var/lib/mysql/
Running threads: 1 Stack size: 262144
Current locks:
lock: 0x127e9528:
lock: 0x12771468:
lock: 0x127dcfb8:
lock: 0x127e4dd8:
lock: 0x127e0f58:
lock: 0x12748588:
lock: 0x127c3568:
lock: 0x127bf2d8:
lock: 0x1276b9e8:
lock: 0x1278b108:
lock: 0x1279aed8:
lock: 0x12768978:
lock: 0x127a5ff0:
lock: 0x127d67e8:
lock: 0x127d42e8:
lock: 0x127d1aa8:
lock: 0x127cf6c8:
lock: 0x127cd738:
lock: 0x127b8cc8:
Key caches:
default
Buffer_size: 8384512
Block_size: 1024
Division_limit: 100
Age_limit: 300
blocks used: 7
not flushed: 0
w_requests: 164
writes: 86
r_requests: 159
reads: 4
handler status:
read_key: 19
read_next: 31
read_rnd 0
read_first: 30
write: 706
delete 4
update: 5
Table status:
Opened tables: 613
Open tables: 26
Open files: 52
Open streams: 0
Alarm status:
Active alarms: 1
Max used alarms: 2
Next alarm time: 28635
Begin safemalloc memory dump:
End safemalloc memory dump.
Memory status:
Non-mmapped space allocated from system: 7983104
Number of free chunks: 34
Number of fastbin blocks: 0
Number of mmapped regions: 11
Space in mmapped regions: 23605248
Maximum total allocated space: 0
Space available in freed fastbin blocks: 0
Total allocated space: 6866800
Total free space: 1116304
Top-most, releasable space: 1045872
Estimated memory (with thread stack): 31850496
Events status:
LLA = Last Locked At LUA = Last Unlocked At
WOC = Waiting On Condition DL = Data Locked
Event scheduler status:
State : INITIALIZED
Thread id : 0
LLA : n/a:0
LUA : n/a:0
WOC : NO
Workers : 0
Executed : 0
Data locked: NO
Event queue status:
Element count : 0
Data locked : NO
Attempting lock : NO
LLA : drop_schema_events:375
LUA : drop_schema_events:377
WOC : NO
Next activation : never
110705 3:28:09 [Note] /usr/sbin/mysqld: Normal shutdown
110705 3:28:09 [Note] Event Scheduler: Purging the queue. 0 events
答案1
# service mysql Status
MySQL is not running, but lock exists [FAILED]
这意味着 MySQL 没有正常关闭。pid 已被删除,但锁文件仍然存在。删除锁文件并重试:
# rm -f /var/lock/subsys/mysqld