Wamp Server put into dropbox, disable the log in the data folder - mysql

What I want to do is pretty simple. I would like to have sync for www and mysql/data folder sync.
I have successful make the change, first I point www folder to dropbox, and change the my.ini
datadir=C:/Dropbox/web/mysql/data
(note: I know some ppls might comment, it is not good to have the mysql data sync, and try to use remote mysql database, but my problem is I do not have internet connection all the time, or my internet connection is pretty bad / slow), I just like localhost speed :)
Now my problem is, inside my C:/Dropbox/web/mysql/data there is a lot mysql-bin.0000xy file. How I can remove it, and totally disable the log in mysql.
I had tried.
login to root in mysql run
SHOW VARIABLES;
SET sql_log_bin=0;
SET GLOBAL expire_logs_days=10;
FLUSH LOGS;
PURGE BINARY LOGS TO 'mysql-bin.000001';
PURGE BINARY LOGS BEFORE '2011-12-31 23:59:59';
The log files still appear inside C:/Dropbox/web/mysql/data
Next I tried this
SHOW BINARY LOGS;
Error Code : 1381
You are not using binary logging
What I want just get rid for the log file inside my mysql data folder, so I can save the space, and dropbox do not need to sync it.

http://systems.takizo.com/2009/08/23/how-to-remove-mysql-binary-log/
To clean up Binary Log on Master Server
shell> mysql -u username -p
mysql> RESET MASTER;
A client that has the SUPER privilege can disable binary logging of its own statements by using a
SET sql_log_bin = 'OFF'
statement.

Related

how to give privilege for global variable write in mysql like slow_query_log?

When I create slow_query_log rotation, I need one user for set & update slow_query_log as On and Off. How can I give permission for only this query or global variable access to user?
FLUSH SLOW LOGS;
was added in 5.5.3.
SLOW closes and reopens the slow query log file.
If you are on a *nix OS, first you mv the log file to a new name on the same filesystem (as part of the "rotation" script), then you issue FLUSH .... Through the magic of the way Unix files work, nothing is lost. mysqld continues to write to the old file, even though the name has changed. Then the FLUSH causes mysqld to stop writing to it, and write to a new file. (Windows is another matter.)
You could use mysqladmin instead of mysql.
I would create a new user with the minimal privileges for this action. (I think it is just RELOAD.)

Limiting mysql log file size

I have a mysql log file that regularly goes over 30gb, this sucks when you realise that your server is full because of this file. I need a simple solution to limit this file to about 1gb, i don't need logs that run that long, and i'd rather avoid this problem in the future.
Any ideas? Thanks
To specify it in the my.cnf file, backup your current my.cnf file (always recommended), stop slave, stop the MySQL server and place the following option:
# relay log restrictions
relay-log-space-limit=15G
Then save and quit the file and start MySQL. Unless you configured differently, MySQL will automatically start the slave thread.

WAMP server. Very large data directory in MySQL?

I have problem with wammp server.
In directory "..\WampServer\bin\mysql\mysql5.5.8\data" was created files with very large size.
Full size of this directory is 50GB. What is these files? How can I fix this problem?
The names of files are:
mysql-bin.000001
mysql-bin.000002
................
mysql-bin.000227
The size of all files is 49GB
Thanks in advance!
By default whenever you make a change to a MySQL database it creates a log of the query and stores it in a file simlare to mysql-bin.000001. The MySQL database does this so that you can recover or replicate a database. Most applications this is a good things to have enabled just like doing regular backups.
If you want to disable MySQL from creating these binary logs:
Open my.ini
Search for this line log-bin=mysql-bin
Comment this line out by adding a hash mark: # log-bin=mysql-bin
Save and restart the MySQL database
You can now safely delete these files from that directory.
I did another thing on my wamp...
http://dev.mysql.com/doc/refman/5.0/en/purge-binary-logs.html
Start a command prompt and goto directory wamp\bin\mysql\mysql5.5.16 or whatever version number you got
type:
mysql.exe -u root
SHOW BINARY LOGS;
a list with all the log files will be show up. We need the last one.
In my case was mysql-bin.000412
so i typed
PURGE BINARY LOGS TO 'mysql-bin.000412';
and you are ok!

In MySQL, how can I delete/flush/clear all the logs that are not necessary?

I have tried several commands (FLUSH LOGS, PURGE MASTER) but none deletes the log files (when previously activated) or the log tables (mysql/slow_log.CSV and mysql/general_log.CSV and their .frm and .CSM counterparts).
SHOW BINARY LOGS returns "You are not using binary logging".
Edit: I found this simple solution to clear the table logs (but not yet the file logs using a mysql command):
TRUNCATE mysql.general_log;
TRUNCATE mysql.slow_log;
FLUSH LOGS just closes and reopens log files. If the log files are large, it won't reduce them. If you're on Linux, you can use mv to rename log files while they're in use, and then after FLUSH LOGS, you know that MySQL is writing to a new, small file, and you can remove the old big files.
Binary logs are different. To eliminate old binlogs, use PURGE BINARY LOGS. Make sure your slaves (if any) aren't still using the binary logs. That is, run SHOW SLAVE STATUS to see what binlog file they're working on, and don't purge that file or later files.
Also keep in mind that binlogs are useful for point-in-time recovery in case you need to restore from backups and then reapply binlogs to bring the database up to date. If you need to use binlogs in this manner, don't purge the binlogs that have been written since your last backup.
If you are on amazon RDS, executing this twice will do the trick:
PROMPT> CALL mysql.rds_rotate_slow_log;
PROMPT> CALL mysql.rds_rotate_general_log;
Source: http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_LogAccess.Concepts.MySQL.html
It seems binary logging is not enabled in your server .And i guess you want to delete the old log files which were used/created at the time of binary logging is enabled . you can delete them manually using 'rm' command if you want . if you want to enable the binary logging you can do the same by updating the configuaration file ( but it needs restart of the server if it is already running) . You can refer below links.
http://dev.mysql.com/doc/refman/5.0/en/replication-options-binary-log.html#option_mysqld_log-bin
http://dev.mysql.com/doc/refman/5.0/en/replication-options-binary-log.html#sysvar_log_bin

MySQL binary log after restore

I've got an issue with a legacy system I've inherited. Every night a dump from live is run (to script) and restored to QA from said script e.g.:
mysql [params] < path/to/backup.sql
This causes the creation of lots data in the bin logs (DB is a few gigabytes). The bin logs don't seem to get flushed automatically - I can clear them down by running RESET MASTER; from the mysql command line but was wondering if there was any way to automate this? It's running on mysql 4.0.21 under Windows.
EDIT:
It's not running as a master to any slave dbs
flush logs
or update & restart mysql server by comment out log-bin = xxx,
but this will disabled the replication
The following will disable sql statements being logged to binary.
mysql> set sql_log_bin=0
mysql> source path/to/backup.sql
This applies to current thread only and is much faster.