Answer the question
In order to leave comments, you need to log in
Fixing Duplicate Keys in a Database Using PHP
Given : there is a MySQL database, a forum is spinning on it. It has been spinning for a long time, no one updated the forum engine, so duplicate keys appeared in the database, which makes it impossible to automatically convert the forum to another engine. The database is rather big (uncompressed dump 200 MB), I really don't want to edit the handles, in addition:
Not given : phpmyadmin, cpanel, ssh or any other intelligible way to work with the database, only ftp and the ability to run php scripts.
Question: Is there a way to fix the database from duplicate keys in such conditions that is not associated with a bunch of hemorrhoids and small manual work?
Forum XMB
Answer the question
In order to leave comments, you need to log in
One of the simplest - we hang a unique key forcibly, and demolish it.
ALTER IGNORE TABLE `backup` ADD UNIQUE( `title`);
ALTER TABLE `backup` DROP KEY `title`;
In general, the second question - does anyone know which version of PhpMyAdmin still worked with PHP4? Not to go over everything :)
Try playing around with LIMIT 1.1. If it doesn’t return anything, then there is no duplicate key, if it returns, it’s already there, you will have to fix it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question