Search MySQL db for word
Hello, I am trying to search a database for a word, except I do not even know what table or field it is in. Could anyone please help me with the syntax to search the entire database? Thanks in advance.
You might want to look into the Sphinx plugin... http://sphinxsearch.com
Outside of that, I'm not sure how you would do such a search without a heap of manual JOINs.
Sorry for the less-than-ideal reply. I'm a bit of a noob myself when it comes to this stuff! Sphinx does sound promising though!
Assuming your tables are MyISAM (the default) then you can look into using fulltext indexing and searching (aka, match(field1,field2,field3) against('word")... ). You can grab results using a single query if all th fields are in one table, in they're in multiple tables you can do a union of the results.
To do this you'll need to add fulltext indexes to each of the fields you want to search. For performance sake, the default settings create indexes for words greater than 3 characters, but you can change that setting if need be.
Here's a helpful page on fulltext searching:
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)