Hello BC ... Thanks for your assistance with this one.
I agree that the data could be wrong where say a value was changed from 109.99 to 51.00 and as a dollar amount unless you know what was sold to determine if the figure is correct it could get skipped and skew reports and balances etc.
I suggested to the guys that they should start fresh with a new clean database for new entries and for looking up old info in the old database just to be cautious that the info returned may be incorrect.
I found more on this while working with it. The database reports the following:
MySQL is starting with mysql\bin\my.cnf (console)
150505 11:23:07 [Warning] '--skip-locking' is deprecated and will be removed in
a future release. Please use '--skip-external-locking' instead.
150505 11:23:07 [Note] Plugin 'FEDERATED' is disabled.
150505 11:23:08 InnoDB: Started; log sequence number 0 44253
150505 11:23:08 [Warning] mysql.user table is not updated to new password format
; Disabling new password usage until mysql_fix_privilege_tables is run
150505 11:23:08 [ERROR] Column count of mysql.db is wrong. Expected 22, found 20
. The table is probably corrupted
150505 11:23:08 [ERROR] mysql.user has no `Event_priv` column at position 29
150505 11:23:08 [ERROR] Event Scheduler: An error occurred when initializing sys
tem tables. Disabling the Event Scheduler.
150505 11:23:08 [Note] mysql\bin\mysqld: ready for connections.
Version: '5.1.73-community' socket: '' port: 3306 MySQL Community Server (GPL
)
From looking online it looks like they upgraded from 5.0 to 5.1 at some point and this problem started with that. This problem above is probably not related to their memory issues that they had because many others out there had the same problem such as one person reporting that 3 systems upgraded from 5.0 to 5.1 got the same problem so it sounds like an upgrade bug.
Called client and asked if he had upgraded the version of MySQL in the past or not. He said yes, he had some college kid doing some work for him and the kid suggested an upgrade to 5.1. I informed him that the upgrade to 5.1 had a few issues and that I am going to try to work out those issues that the kid that he had working on this should have seen and dealt with. From what i have read it looks like the database can actually run ok with these problems and so the kid may have said well it works ... give me my pay for work and moved on figuring no one would ever know any better. OR he clearly missed checking the status of the database and it worked so there must be no problems.
More info here on this:
http://forums.mysql.com/read.php?26,600179,600179#msg-600179As far as the problems with expecting an INT and getting troubled data from the old database it looks like those problems are gone for now. Reports are now working that didnt work before because they would hang or crash because of garbage entries where somehow alpha string data got passed to an INT32 etc. I ended up sorting the columns using SQLyog to place values lowest to highest and this then shifts the bogus ( non INT data ) to be at the bottom of the list with numbers proceeding the alpha junk that somehow got passed to an INT32 etc. As far as if a value that is an INT was passed as incorrect value to database though, its still hidden in the mix of numbers. So the old data cant be trusted as 100% correct.
Contacted client and informed him that he needs to start with a fresh database and that he would still have access to old database for checking on info that may or may not be correct. Renamed old database and placed it to work side by side the new clean database. New clean database is same name as original database and so the interface they are using will work without problems. The old database with a new name I just needed to change the path in the PHP header to point to OldDatabase and create an alternate button on the main page to point to old database
such as editing the header of the php of the alt main code to be, where username and password is X'd out to not share clients actual database credentials.
<?php
$servername = "localhost";
$username = "xxxxxxxxxx";
$password = "xxxxxxxxxx";
$dbname = "OldDatabase";
So I guess I need to follow this guide to fix the MySQL Database issues
http://dev.mysql.com/doc/refman/5.1/en/upgrading-from-previous-series.htmlMainly
mysql_upgrade needs to be run on it, but not going to do this until I perform a backup after all the work put into fixing corruption.
http://dev.mysql.com/doc/refman/5.1/en/mysql-upgrade.html