database records missing randomly in mysql - mysql

I am using joomla as CMS I have a system of creating users from the back end and give those login information to the users to log in our site we are following this system as we only serve a selected group of people.
but I have noticed that some records were missing randomly in our database we are using phpmyadmin and database MySQL ,I have noticed the issue when some users complained that they couldn't login on our site with the credentials provided by us .When I checked the database table I found out that some records were missing randomly .I am totally puzzled and helpless please help me.

Records do not under any normal circumstance disappear from databases spontaneously. Some specific actions must cause this.
First, carefully analyse your reasons for thinking the database ever had the record.
You have a process by which data is created. Suppose the code went:
Generate username/password
Print it out (and hence pass to user)
Insert into database
and that last step failed, would you ever know? Can you run a quick query across the database when you believe the record should be there to check that it is?
If instead your code goes
Generate username
Insert into database
Read from database
Print it out
Then you have some evidence that the record did exist, now you need to track down when the deletion occurred. Somewhere there must be a delete running.
You need to get very analytic, gather evidence.

Related

How to find history of commands run on mysql

I sort of have a heart attack of a problem. I had a non-root utility user in mysql that used to be able to see all the databases, tables, etc. on the mysql instance. The user was also able to insert records, delete records, create tables, etc. too. This user is used by scripts to edit records, or view the data as someone who's not root via phpmyadmin.
I don't know how Django fits into this or if it was even the cause but a contractor needed access to the db to work on their project we asked them to work on. They said they were using Django and needed to create some auth tables in the database (auth_group, auth_user, auth_user_groups, etc.)
However, after they added their tables for Django, that utility user can't see anything except the "information_schema" database.
Luckily, I checked using the root user in mysql and can see the databases but somehow, I still cant see the databases with the non-root user. I don't see anything that jumps out at me permissions-wise in the "user" table in mysql so I'm not sure how to fix this problem. I want to see what commands the contractor ran to get us into this situation to tell them not to do this again.
I was going to check the .mysql_history file in the unix root user directory but the funny thing is the file is dated from 3 weeks ago so it doesn't look like this will yield any info on what was run.
So, back to my original question, where can I see a history of mysql commands that were run on mysql so I can figure out what happened or what was run to get us into this funny situation?

Where to find mysql logs regarding user changes in phpmyadmin

I want to know, is there a log that saves all the changes made by users to a database just like in git where all the commits can be viewed by each user so that if any error occur we know who did it.If there is one how to get it? or how to create one that will do it?
Problem I'm facing is that a table's data has been altered by one of the developers but there is no way to find when and who did it and also I am struggling to find all the changes that has been done to the table.
Databases typically do not provide auditing as standard. I typically implement it within my application. However, for a faster result, there are some plugins for mySQL which you could try.

Blank rows are inserting in the database table

I have a project that is developed in CakePHP with MySQL. The problem is daily 2-3 records are getting entered in the 'products' table with 0 values in the fields.
There are 2 ways of entering data via application - Front-end & Admin panel. Both forms are authenticated (via ACL) and having validations (client side and server side). But not able to find how these blank records are coming on daily basis.
Any help regarding, in which area I have to look to solve the issue, would be appreciated.
How come people say rows are inserting in the database automatically?.
A computer doesn't do any thing by its own unless you direct it to do.
Current Question where it stands*
I see two possibilities:
1.There might be an event scheduler running at a fixed time in your DB. Explanation
Referenced from here
2.Someone might be doing it without your knowledge.

Find out what application is writing to SQL table and when

Is there anyway to audit a SQL table where you can get information such as what application is writing to it and when it writes to it?
There are a bunch of applications users are using here and I have combed through each on and cannot find where any of them write to this one table in SQL Server. And it's an important table.
It's driving me crazy.
You have to set up auditing from the start (usually through triggers that write to audit tables that include the user or application that is writing to the table). There is no way to find this information for past data if you did not have auditing designed into your system.
When you set up the audtitables you might want to include fields that are populated by these system variables:
suser_sname(),
host_name(),
app_name(),
getdate()
If you know the exact time it is happening you can catch them in the act using sp_who2 or sp_whoisactive type procedures that return lots of useful information about currently running processes.
However, it sounds like you cannot foresee this activity so I would suggest running a SQL Profiler trace and filter on the database and table in question. Be sure to capture the events that will help you finger the responsible party (LoginName, HostName, etc.). There are countless articles on the Net that walk you through a simple trace.

MS Access 2003: Can data disappear from records and how do I test for this and prevent it?

Problem and about the database: Data from a record in Access 2003 database has disappeared. This database has 1 backend and 3 frontends, multiple users and is hosted on Citrix. Within this database, we have records of all clients served, ranging in the 1000s.
Background info: The form for client data entry is set up with various subforms, including both a "programs enrolled" subform and a "services" subform. A client can be enrolled in multiple programs. Once enrolled in a program, services can be entered for that program area using the services subform. There are multiple fields in the services subform, one of which is a drop-down field allowing you to choose from the programs a client has been enrolled in (the list is updated for that client whenever he is enrolled in a new program).
The problem details: For one specific record and one specific program area, the program has disappeared from the "programs enrolled" subform and all of the related services have disappeared from the "services" subform for a period of 3 months of data entry. However, other programs and services for this record did not disappear.
Questions: Is the disappearance of data a common Access 2003 problem? Are there tests in place that can be run to see if data is disappearing and catch that data? If so, what are they? If there is specific code involved, what is it? What can be done to prevent the disappearing of data (other than using a different database)?
As #HansUp says, this is not a common issue. Two things spring to mind:
Jet/ACE files do not like to be stored on file servers with replicated file systems unless the file is edited on only one side of the replication synch. That is, if two servers have a replicated volume and you have people connecting to both servers and trying to edit both copies of the database, you'll hose the data. If you're editing on only one side, there shouldn't be any issues, but I worry about this kind of thing. Another issue might be virtualization, though I don't have any definite scenario where that could be a problem.
More than 10 years ago I saw an issue that combined the old bookmark bug with On Error Resume Next that caused data to not be saved. What was happening was that turning off error reporting/handling with the On Error Resume Next was not properly going out of scope, and errors that were occuring in the departure from a record via bookmark navigation were never being reported. The result was that edits were lost. When I changed the bookmark navigation to save the record if it was dirty before changing the bookmark pointer, the problem went away. But while I was at it, I eliminated as many On Error Resume Next statements as possible.
Another guise of the second problem would be if DoCmd.SetWarnings is set to False. I never bother with SetWarnings, so it's not an issue, but it's a common novice technique, and worth looking at. The idea is that errors are happening but the report of them is not getting to the users, and thus, the edits are being lost.
I don't consider either of these very likely, but your situation is so uncommon that even unusual things like these are worth looking at.
Is the disappearance of data a common Access 2003 problem?
No. Data in any version of Access does not just disappear without cause. Unless perhaps your database file has been corrupted. More likely you have a design error in your form and/or database schema.
If you have a form/subform based on parent and child tables, make sure you have a relationship established and that you enforce referential integrity on that relationship. That is a standard practice to ensure you can't delete a parent record while you still have at least one related record in the child table.
Based on your description, it's not clear whether the data is missing from your data tables or just not appearing in your subform when you expect to see it. You might want to clarify that point.
At this point, we have determined that the missing data occurs at random and is not traceable to a specific pattern which makes it rather difficult to pinpoint a solution. We are still uncertain if the data actually disappeared or if the user assumed he had entered the data but had not. Unfortunately, our db host does not keep a series of backups that we could trace back to, but rather updates the backup at the end of each day--again raising a problem for tracing the disappearance. We will continue to investigate the various answers provided here and are grateful for your great input and suggestions.