Knowledgebase

Can we delete sql logs ?

Posted by lockingout, 07-07-2008, 06:12 AM
Can we delete sql logs ? as it occupies 2.97gb All the log is under a single file, occupying huge amount of space on our server use lxadmin for the vps we are unable to even open up the file, as we have almost run out of space, we would atleast like to delete around old logs older than a month, this logs are from 3 months, so please help us in solving this problem if we delete the sql log, will a new log be created automatically or it gives an error ?

Posted by unity100, 07-07-2008, 06:24 AM
you could. im regularly having ours in /var/lib/mysql cleaned by a cron.

Posted by lockingout, 07-07-2008, 06:40 AM
in the following thread : http://sql-server-performance.com/Co...ms/t/5740.aspx it mentioned not recommendable to clear logs so there would be no problem rite ? actually ours is at : /var/log/mysqld.log so it safe enough ?

Posted by lockingout, 07-07-2008, 06:46 AM
I don't want any complex so kindly inform me if its safe enough and where to delete the http logs thats displayed in log manager ? This is the error I get when tried to access mysql log : Fatal error: Out of memory (allocated 414973952) (tried to allocate 402391041 bytes) in /usr/local/lxlabs/lxadmin/httpdocs/htmllib/lib/commonfslib.php on line 326

Posted by YUPAPA, 07-07-2008, 01:18 PM
Can't you just disable SQL logs if you don't really want them? I don't think logging is enabled by default. Login to SSH to do it if you can't delete with a php script.

Posted by unity100, 07-08-2008, 02:04 AM
you aint gonna delete it. you gonna the ones that are rotated out to insertlonghostnamehere-something.bin (or whatever your server renames them). at cpanel servers at least.

Posted by ub3r, 07-08-2008, 02:20 AM
Some people enable it when copypasting 'optimized' my.cnf files from tutorials. They should be able to just remove 'bin-log' from my.cnf and restart the mysql daemon. i don't think his mysqld.log file is causing any slowdowns though.

Posted by lockingout, 07-08-2008, 04:26 AM
I don't think we have enabled it and I don't find an option to disable them, deletion is possible via lxadmin panel but my question is it safe enough we are not using cPanel atleast on our current server, we are using lxAdmin actually we got everything installed by our server as we are on VPS." my.cnf " where's that around ? mysqld.log files isn't causing slow downs, its eating up our space more than 3gb

Posted by activelobby4u, 07-08-2008, 04:46 AM
you can clear the logs using the command >log_file

Posted by lockingout, 07-08-2008, 05:27 AM
what does this command do ? log_file ? you mean as log_sqld will delete the entire logs ?

Posted by Lsupport, 07-08-2008, 07:05 AM
You need to run this command (incliding '>') to clear log file eg: say your log file is at /var/log/mysql.log you have to run

Posted by lockingout, 07-08-2008, 07:23 AM
actually my problem is not how to delete but its an query on whether is it safe enough and do the logs again get created or not

Posted by ~ServerPoint~, 07-08-2008, 09:54 AM
Yes, you can delete the log file. It will be created automatically after restarting mysql in the sever.

Posted by foutrelis, 07-08-2008, 11:08 AM
The "command" suggested to clear the log file, "> /var/log/mysqld.log", is a feature of the shell called redirection where it opens the file for writing. Since there is nothing to redirect into that file, it will just be emptied. Deleting the file and restarting the mysql daemon will do the trick as well, as others have already mentioned. However, I would suggest seeing what the log file contains before deleting it. For a mysql log, it's quite large so it's worth checking out what's going on. This will need to be done through SSH, as LxAdmin's php scripts can't handle such big files. Just log into your server with SSH and do "more /var/log/mysqld.log", to move down press the "enter" key and to quit press "q". Last edited by foutrelis; 07-08-2008 at 11:11 AM.



Was this answer helpful?

Add to Favourites Add to Favourites

Print this Article Print this Article

Also Read
Gigenet outage? (Views: 607)
Questions. (Views: 615)


Language:

Client Login

Email

Password

Remember Me

Search