Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
Turn on bin-logs and you will be happy. You can roll back in time to any moment, up to seconds.
Just make your own triggers. For example like here - www.jasny.net/articles/versioning-mysql-data/
To a question in such a general form, the only correct answer is binary logs.
Already from the specifics of the question itself, the decision may change.
I agree with the use of triggers. You can roll back - there will be all information about changes in any table, as transparently as possible.
An example of using habrahabr.ru/blogs/mysql/121129/ .
It’s also very good for transparency not to call sql statements from the code right away, but to make a layer in the form of your library of functions for accessing the database, then you can write all queries to the logs directly in the form of SQL statements (CREATE, ALTER, UPDATE, DELETE, INSERT .. .), in this form it is very convenient to edit the magazine, cut it into pieces, and upload it to the database. If every day the logs are written to a separate file, then it’s generally convenient: for backup and restoration, for synchronization with another database, for understanding what and how many requests the system makes, well, for optimization, I recommend writing the execution time there so that you can allocate long requests. MySQL has of course a built-in logging tool, in /etc/mysql/my.cnf there is a line "log = /var/log/mysql/mysql.log" and it is usually commented out. If you uncomment it, then it will not be a separate project that will be logged, and all databases on the server. Only slow queries "slow-queries=sloq.log" can be logged. We have already talked about binary logs and they are good because you can choose which database to log. But I prefer to write the logs myself, because. you can do some other additional operations on them, for example, parse and analyze, build statistics, identify errors and do something, in general, for transparency - you need your own layer, and I consider it bad form to call PDO or mysql_query directly from the program code . Even if you don’t have anything hung now, but at any moment you may want to hang something, believe me, when the system is a couple of years old and there are thousands of files in it, then such logging is indispensable for fixing a problem or finding an error. Even sometimes, in the form of a temporary patch, you can correct SQL statements before they are executed. Only slow queries "slow-queries=sloq.log" can be logged. We have already talked about binary logs and they are good because you can choose which database to log. But I prefer to write the logs myself, because. you can do some other additional operations on them, for example, parse and analyze, build statistics, identify errors and do something, in general, for transparency - you need your own layer, and I consider it bad form to call PDO or mysql_query directly from the program code . Even if you don’t have anything hung now, but at any moment you may want to hang something, believe me, when the system is a couple of years old and there are thousands of files in it, then such logging is indispensable for fixing a problem or finding an error. Even sometimes, in the form of a temporary patch, you can correct SQL statements before they are executed. Only slow queries "slow-queries=sloq.log" can be logged. We have already talked about binary logs and they are good because you can choose which database to log. But I prefer to write the logs myself, because. you can do some other additional operations on them, for example, parse and analyze, build statistics, identify errors and do something, in general, for transparency - you need your own layer, and I consider it bad form to call PDO or mysql_query directly from the program code . Even if you don’t have anything hung now, but at any moment you may want to hang something, believe me, when the system is a couple of years old and there are thousands of files in it, then such logging is indispensable for fixing a problem or finding an error. Even sometimes, in the form of a temporary patch, you can correct SQL statements before they are executed. We have already talked about binary logs and they are good because you can choose which database to log. But I prefer to write the logs myself, because. you can do some other additional operations on them, for example, parse and analyze, build statistics, identify errors and do something, in general, for transparency - you need your own layer, and I consider it bad form to call PDO or mysql_query directly from the program code . Even if you don’t have anything hung now, but at any moment you may want to hang something, believe me, when the system is a couple of years old and there are thousands of files in it, then such logging is indispensable for fixing a problem or finding an error. Even sometimes, in the form of a temporary patch, you can correct SQL statements before they are executed. We have already talked about binary logs and they are good because you can choose which database to log. But I prefer to write the logs myself, because. you can do some other additional operations on them, for example, parse and analyze, build statistics, identify errors and do something, in general, for transparency - you need your own layer, and I consider it bad form to call PDO or mysql_query directly from the program code . Even if you don’t have anything hung now, but at any moment you may want to hang something, believe me, when the system is a couple of years old and there are thousands of files in it, then such logging is indispensable for fixing a problem or finding an error. Even sometimes, in the form of a temporary patch, you can correct SQL statements before they are executed. But I prefer to write the logs myself, because. you can do some other additional operations on them, for example, parse and analyze, build statistics, identify errors and do something, in general, for transparency - you need your own layer, and I consider it bad form to call PDO or mysql_query directly from the program code . Even if you don’t have anything hung now, but at any moment you may want to hang something, believe me, when the system is a couple of years old and there are thousands of files in it, then such logging is indispensable for fixing a problem or finding an error. Even sometimes, in the form of a temporary patch, you can correct SQL statements before they are executed. But I prefer to write the logs myself, because. you can do some other additional operations on them, for example, parse and analyze, build statistics, identify errors and do something, in general, for transparency - you need your own layer, and I consider it bad form to call PDO or mysql_query directly from the program code . Even if you don’t have anything hung now, but at any moment you may want to hang something, believe me, when the system is a couple of years old and there are thousands of files in it, then such logging is indispensable for fixing a problem or finding an error. Even sometimes, in the form of a temporary patch, you can correct SQL statements before they are executed. for transparency, you need your own layer, and I consider it bad form to call PDO or mysql_query directly from the program code. Even if you don’t have anything hung now, but at any moment you may want to hang something, believe me, when the system is a couple of years old and there are thousands of files in it, then such logging is indispensable for fixing a problem or finding an error. Even sometimes, in the form of a temporary patch, you can correct SQL statements before they are executed. for transparency, you need your own layer, and I consider it bad form to call PDO or mysql_query directly from the program code. Even if you don’t have anything hung now, but at any moment you may want to hang something, believe me, when the system is a couple of years old and there are thousands of files in it, then such logging is indispensable for fixing a problem or finding an error. Even sometimes, in the form of a temporary patch, you can correct SQL statements before they are executed.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question