how to recover the Database Data using binary logs? - mysql

One of our associate has deleted the database as well as the replica is there is a way to recover the database.

Not without a backup. Binary logs are only used to recover from the last backup up to a certain point in time. They can not be used to roll back some statements.

Related

Recreate MySQL database from log

Im researching the best way of logging queries in MySQL database. The log should be used for two things:
Documentation of system activity
Used to recreate the database (in case the database is hacked or otherwise corrupted)
It's possible to log all queries in a MySQL database (like this example)
Question: It is possible to recreate a database on the basis of the log file, or should I use a different approach?
You can use replication logs for this - they store the complete set of operations. You should be able to create a new database from original sources and apply all changes upon it.
You can do complete dumps (i.e. once a week) and archive the replication logs on daily basis.

Accidently Emptied Tables in the Wrong Database (Using PHPMyAdmin for MySQL), Anyway to Restore Data?

As the title states, I accidently emptied tables in the wrong database. I did not export the database before I did this (stupid me). Is there anyway to restore the database to a previous date/version, so that I may obtain the emptied data back?
There is no way to recover deleted data if you didn't make any backups. You could try to check the logs, but I doubt you will find anything. You have to be careful when handling important data.
Sorry for you, but you should automate your mysql backup (in this case you lose at worst one day of data). I use this script to do that : https://sourceforge.net/projects/automysqlbackup/
HTH

Audit state-change in MySQL

Assume a number of conventional LAMP-style applications which use MySQL as a back-end to record the 'current durable state' for the applications.
I am interested in establishing an 'audit' of transitions at the database level - and storing them as a log. The idea is that - assuming the MySQL database has been 'dumped' at the beginning of the day, it would be possible to 'replay' transactions against the back-up to recover any state during the working day.... A bit like time-machine for MySQL - I guess.
I have found some documentation about "Audit plugins" which look relevant but leaves me with more questions than answers.
http://dev.mysql.com/doc/refman/5.6/en/writing-audit-plugins.html
Essentially, I'd like to establish if it would be feasible to write a MySQL plugin to achieve my goal - such that it would work 'seamlessly' with existing MySQL applications?
The principal detail I'm finding it difficult to ascertain is this: When the audit-plugin is notified of an event, what is the mechanism by which the new data can be established in order to log it? How are data types encoded? How hard would it be to write a tool to 'replay' this audit against a 'full-system-backup' using mysqldump, for example?
Are there any existing examples of such plugins?
You just want MySQL's Point-in-Time (Incremental) Recovery Using the Binary Log:
Point-in-time recovery refers to recovery of data changes made since a given point in time. Typically, this type of recovery is performed after restoring a full backup that brings the server to its state as of the time the backup was made. (The full backup can be made in several ways, such as those listed in Section 7.2, “Database Backup Methods”.) Point-in-time recovery then brings the server up to date incrementally from the time of the full backup to a more recent time

Problem in Recovering the Lost Data from the Database files (.mdf and .ldf)

Recently, one of our clients has deleted two million rows from a table.
Here the problem is the database is not taken backup. I have only the master data file (.mdf) and Log data file (.ldf) with me.
I have downloaded some demo version of Sql tool, through which i am able to open the .mdf file . When i opened the .mdf file using the Sql tool all the lost data is there in the .mdf file but i cant save or export the view of the Lost data from .mdf file from the tool until i purchase it.
I had followed many steps that has shown in MSDN and various websites to recover but with all a failure. Can any one help me, what is best process to recover the deleted data and put in .ldf file.
One of the Sites which I have referred to recover the data is Recover Lost Data
What is the cost of losing the data? What is the cost over time of losing the data--that is, is it more and more the longer the data remains lost? Compare this cost with the cost of the tool you have found that (apparently) works, and factor in the cost of the time it has and is taking you to find a different solution. It seems likely that, unless they're charging ridiculous amounts of money [can you post the product and cost?], you'd be better off biting the bullet, paying them, and using the product right away, with the (implicit) guarantee of a refund if it doesn't work.
Another option is to get a transaction log reading program that can read and work with data stored in the transaction log... but if you're not doing backups, then your databases are (hopefully!) in Simple recovery mode, and depending on how active your databases are that data may have long-since been dropped from the transaction log. However, all such programs that I've heard about also have licensing fees.
Because yes, recovering deleted data from a SQL Server database is a hard thing to do.

MySQL Wrong Restore Data Recovery

I'm almost certain about the answer, but the situation is so critical that I have to ask this question even though I'm %99 sure about the answer.
Someone in our office made a backup of a MySQL database and he restored it on a wrong destination database overwriting everything on that destination (The schema of both databases were the same). According to the structure of the MySQL backup files I know that the restore operation drops all the tables first and then creates them and fills them up with the backed up data. The question is does the restore module keeps the old data anywhere? Is there anyway of retrieving any of the old data? (logs?.. etc.)
Only if you have replicated slaves, or you used to, and have binary logs. Even then you'd need an old copy of the database you can restore, and to configure replication again.