简体   繁体   中英

Enable the MySQL Binary log

How do I enable the Binary log in mySQL. I have tried:

1) Entering this SQL code on phpmyadmin

SET GLOBAL log_bin ='ON'

This gave me an error message that bin_log is a read-only file;

2) Inserting this into my.ini file below [mysqld]

--log-bin= C:\mySqlbinlog

This displays that I cannot access the database when I try to get to the webpage.

Any idea how I can enable the Binary Log through phpmyadmin or in the my.ini file? Any help appreciated.

Just Put log_bin parameter after mysqld. Please give path for binlog where you have large amount of space because binlog eats lots of disk space.

log_bin = "path where want to store bin files.extension"

You can also use some other parameters like max_binlog_size , max_binlog_cache_size , sync_binlog for well performance

For More Here's [a link] ( http://dev.mysql.com/doc/refman/5.5/en/replication-options-binary-log.html )

According to the documentation , the option-file format is log-bin , so you should put this in your my.ini (under the [mysqld] heading):

log-bin=C:\mySqlbinlog

Don't forget to restart the MySQL server process afterward!

I currently use wamp with MySQL ver 5.6.17 so your milage may vary.

Open your my.ini file and scroll through it. You're looking for the [mysqld] section. Add log-bin=C:\\Your_Dir_Here to the [mysqld] section. Restart the MySQL services. Once the restart has finished, login to MySQL. Run the command SHOW BINARY LOGS;

You should then see an output like this:

+------------------+-----------+
| Log_name         | File_size |
+------------------+-----------+
| MySQL_Log.000001 |       120 |
+------------------+-----------+
1 row in set (0.00 sec)

NOTE I don't know exactly how log-bin works but I would recommend an absolute path so you know exactly where your log files will be. Also, your MySQL installation won't read the my.ini file until it's services restart.

Further reading http://dev.mysql.com/doc/refman/5.6/en/binary-log.html

This link covers a great deal about the binary logs. It literally covers too much for me to even gloss over.

If I've left something out or if I was vague on something, leave a comment and I'll try to reply back.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM