Welcome to the most active Linux Forum on the web.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 08-14-2003, 08:27 AM   #1
Citizen Bleys
Registered: Mar 2001
Location: Moncton, NB
Distribution: Gentoo 2006.0
Posts: 181

Rep: Reputation: 30
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 ><
Old 08-14-2003, 08:49 AM   #2
Registered: Jul 2003
Location: DC
Distribution: mandrake 9.1
Posts: 415

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

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:

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.
Old 08-15-2003, 07:07 AM   #3
Citizen Bleys
Registered: Mar 2001
Location: Moncton, NB
Distribution: Gentoo 2006.0
Posts: 181

Original Poster
Rep: Reputation: 30
But the problem is, I don't know what field it is in.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
mysql error Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. Dannux Linux - Software 3 03-24-2006 09:44 AM
MySQL question... kith Linux - General 3 03-06-2004 07:40 PM
MySQL Question NoBrains Linux - Software 2 03-01-2004 11:10 PM
MySQL question TraCe66 Linux - Newbie 11 07-15-2003 03:35 PM
MySQL question ascii2k Linux - General 1 03-27-2002 05:48 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:09 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration