LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   MySQL question (https://www.linuxquestions.org/questions/programming-9/mysql-question-81903/)

Citizen Bleys 08-14-2003 07:27 AM

MySQL question
 
Is there a single query that will remove *all* references to a given string in every table?

I have a database backup from a vBulletin forum from 2001, and it won't access any page, because (even though I'm not logged in anywhere), it keeps trying to access session 687ece0471538100384690d06a2bffc6, which doesn't exist. I'd like to remove every row containing the string '687ece0471538100384690d06a2bffc6' from every table--the whole row, not just the field that it's located in. Just to be safe. After all, it takes less than a minute to restore the whole db from backup.

As long as the board keeps trying to authenticate with the invalid session ID, I cannot log in or view any threads--all I can see is the forumdisplay page ><

sk8guitar 08-14-2003 07:49 AM

ok, well if its just in 1 table just do at the mysql prompt, or through php/cgi

Code:

delete from <table name> where <row name>=<whatever you want to delete>
if its just a number you can do it like that, if its a phrase or something liek that put single quotes around what you want to delete, like:

Code:

delete from <table name> where <row name>='<whatever you want to delete>'
if its in multiple tables, i'm assuming you have some kind of id linking everything together, just have a loop to go through every table in the database with that delete line. that will get rid of the entire row containing whatever information you want to delete.

Citizen Bleys 08-15-2003 06:07 AM

But the problem is, I don't know what field it is in.


All times are GMT -5. The time now is 10:38 AM.