朋友的机器因为停电后,无法启动Mysql服务了.服务管理器那里显示MYSQL已启动.但是,在服务管理器里面,停止,重启和启动按钮全变灰了.
于是叫到我帮处理这个问题.
我先查看MYSQL日志:
120823 15:03:00 [Note] Plugin 'FEDERATED' is disabled. 120823 15:03:00 InnoDB: Initializing buffer pool, size = 187.0M 120823 15:03:00 InnoDB: Completed initialization of buffer pool InnoDB: The log sequence number in ibdata files does not match InnoDB: the log sequence number in the ib_logfiles! 120823 15:03:00 InnoDB: Database was not shut down normally! InnoDB: Starting crash recovery. InnoDB: Reading tablespace information from the .ibd files... InnoDB: Restoring possible half-written data pages from the doublewrite InnoDB: buffer... 120823 15:03:02 InnoDB: Started; log sequence number 0 44233 120823 15:03:05 [Note] Event Scheduler: Loaded 0 events 120823 15:03:05 [Note] D:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld: ready for connections. Version: '5.1.57-community' socket: '' port: 3306 MySQL Community Server (GPL) 121101 0:41:29 [Note] D:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld: Normal shutdown 121101 0:41:29 [Note] Event Scheduler: Purging the queue. 0 events 121101 0:41:29 InnoDB: Starting shutdown... 121101 0:41:32 InnoDB: Shutdown completed; log sequence number 0 60351755 121101 0:41:32 [Note] D:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld: Shutdown complete
原因大概知道了.是因为InnoDb的ibdata 文件和ib_log文件大小不对而引起的.
我再打开他的MY.INI,发现他默认引擎是INNODB.我觉得对一般的网站来说,很多时候都用不到事务处理等高级功能,就没必要用这个引擎,
一是性能方面不如MYISAM,
二来是用这个引擎的数据库,只会变大,不会变小.哪怕你把数据库删除了,数据库文件大小一样还是那么大.
且N个表数据放在一个文件里,一出问题,就全完了.
后来,我帮他修改了MY.INI
#默认使用MyIsam
default-storage-engine=MyIsam
#加大两个文件的缓存大小
innodb_buffer_pool_size=512M
innodb_log_file_size=128M
然后删除MYSQL目录里的localhost.pid(就是因为这个文件的存在,让服务管理面板认为MYSQL已启动了),刷新服务管理面板.好了,看到重启和停止按钮了.接着只要点停止,启动,就可以了.
问题解决了.
最新评论