wenfengsun

Mysql启动,停止等问题汇总

Posted on: April 9, 2011

今天在调试程序的时候,突然测试用的mysql服务罢工,怎么都启动不了。

如果不指定prefix,mysql的bin目录会在 /usr/local/bin下,有mysql,mysqladmin,mysqld_safe 等。

我们一般使用$>mysqld_safe &启动mysql,但是此时总是报错:

Starting mysqld daemon with databases from /var/lib/mysql
STOPPING server from pid file /var/run/mysql/mysql.pid
060515 20:31:11  mysqld ended

这个问题可以通过查看mysql的配置文件:/etc/my.cnf中关于error log的配置,来查看error log。

我的errorlog显示:

110409 12:54:20  mysqld started
^G/usr/local/libexec/mysqld: File ‘/opt/mysql_log/master/master-log-bin.index’ not found (Errcode: 13)
110409 12:54:20 [ERROR] Aborting

110409 12:54:20 [Note] /usr/local/libexec/mysqld: Shutdown complete

110409 12:54:20  mysqld ended

很奇怪的显示,说无法找到文件。但是这个文件就在这个目录。

后来联想到权限问题,于是,用root用户启动

$> mysqld_safe –user=root

成功启动。

mysql停止:$>mysqladmin shutdown

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: