MySQL doesn't start after /var/log is cleared

Hi!

Don't know what happened to me, but I removed all files from /var/log directory when its overflow. After reboot mysql didn't start. When I try to start it manually, it throws the following:

Code:
$ ./mysqld
100926  2:37:58 [Warning] option 'thread_stack': unsigned value 65536 adjusted to 131072
./mysqld: Can't find file: './mysql/plugin.frm' (errno: 13)
100926  2:37:58 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
100926  2:37:58  InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name ./ibdata1
InnoDB: File operation call: 'open'.
InnoDB: Cannot continue operation.

I'm not a FreeBSD or *nix expert in fact. Usually I remove large files one by one and see if it works, but this time (don't know what happened to me) I removed everything from this directory.

Please help! What should I do to make MySQL start automatically on system startup as before?

Thanks a lot in advance!
 
It sounds like you might have installed a new version of mysql and not restarted it. I would run mysql_upgrade and see what happens.
 
Thanks for your reply, gordon!

I defenetely did NOT install a new version of mysql... I just cleared /var/log... and that was my dark destiny... :(

I tried
 
I tried mysql_upgrade though and here's the result:

Code:
%mysql_upgrade
Looking for 'mysql' as: mysql
Looking for 'mysqlcheck' as: mysqlcheck
Running 'mysqlcheck'...
mysqlcheck: Got error: 2002: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) when trying to connect
FATAL ERROR: Upgrade failed

It seems logic to me, as mysql server is not running and I can't start it.
 
Most likely you also removed /var/log/mysql/ which prevents mysqld from starting.

If you have problems with /var/log/ filling up edit /etc/newsyslog.conf to reduce the size and number of backups of your logfiles.
 
Thanks for your reply, SirDice!

I created
Code:
/var/log/mysql/
with 777 permission - it didn't help, mysql still doesn't start with the same errors.

Here is my /etc/newsyslog.conf:

Code:
# logfilename          [owner]    mode count size when  flags [/pid_file] [sig_num]
/var/log/all.log                        600  7     *    @T00  J
/var/log/amd.log                        644  7     100  *     J
/var/log/auth.log                       600  7     100  *     JC
/var/log/console.log                    600  5     100  *     J
/var/log/cron                           600  3     100  *     JC
/var/log/daily.log                      640  7     *    @T00  JN
/var/log/debug.log                      600  7     100  *     JC
/var/log/kerberos.log                   600  7     100  *     J
/var/log/lpd-errs                       644  7     100  *     JC
/var/log/maillog                        640  7     *    @T00  JC
/var/log/messages                       644  5     100  *     JC
/var/log/monthly.log                    640  12    *    $M1D0 JN
/var/log/pflog                          600  3     100  *     JB    /var/run/pflogd.pid
/var/log/ppp.log        root:network    640  3     100  *     JC
/var/log/security                       600  10    100  *     JC
/var/log/sendmail.st                    640  10    *    168   B
/var/log/slip.log       root:network    640  3     100  *     JC
/var/log/weekly.log                     640  5     1    $W6D0 JN
/var/log/wtmp                           644  3     *    @01T05 B
/var/log/xferlog                        600  7     100  *     JC

which line need to be changed?
 
mzelensky said:
I created /var/log/mysql/ with 777 permission - it didn't help, mysql still doesn't start with the same errors.
Try not to create world-writable directories. Setup proper permissions and owner/group.

which line need to be changed?
I don't know because I don't know which logfile is filling up your disk. The config file is reasonably self-explanatory. Either reduce the number of backups or the maximum size. Leave the permissions and flags as they are.
 
Oh, and please start mysql the 'proper' way:
# /usr/local/etc/rc.d/mysql-server start

Which mysql settings did you use in /etc/rc.conf?
 
SirDice said:
Oh, and please start mysql the 'proper' way:
# /usr/local/etc/rc.d/mysql-server start

Thanks! This commmand (root user) says:

# /usr/local/etc/rc.d/mysql-server start
Code:
Starting mysql.

But the server doesn't start in fact. I check it this way:

Code:
mysqladmin -u root -p status
Enter password:
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/tmp/mysql.sock' exists!

SirDice said:
Which mysql settings did you use in /etc/rc.conf?

Code:
mysql_enable="YES"
 
Are there any messages in /var/log/messages?

Or the mysql error log?
 
SirDice said:
Are there any messages in /var/log/messages?
Nothing with regards to mysql.

SirDice said:
Or the mysql error log?

Increadible!.. While looking for the mysql error log I found the problem. Silly enough! There was no mysql error log! When I was making /var/log/mysql.log, I mistyped and created /var/log/myslq.log. Now I renamed it to what it should really be and mysql started to work! God, thanks!

Thank you, SirDice! You help is invaluable! My server is up again and I am happy. :) Really happy!
 
DutchDaemon, sorry!

I've just noticed that you kindly corrected my previous postings, thank you!

I'll do my best!
 
Back
Top