How to search for a string in all fields of every table in a MySQL database

Here’s a cool tip I learned recently: If you want to search for a text string in ALL fields of ALL tables in a MySQL database, you can use phpMyAdmin to do this very easily. Here are the steps to search every MySQL/MariaDB database table for your text string.

1) Select the desired database

The first step is to select the database you want to search. Don’t select a table — just select the database you want to search. (If you select a table you’ll get a different search form in Step 2.)

In this image I’m showing that I want to search a database named aa_d8:

2) Go to the Search form

As that image shows, you then want to click the phpMyAdmin “Search” tab. When you do that you’ll see a form that looks like this:

Now all you have to do is fill in your search criteria.

3) Fill in your search criteria

In my case, I wanted to search for the string “shipments”, and I wanted to look in every MySQL database table, so I put that string in the “Words” field and then selected every database table:

4) Press “Go” and browse the results

Once you’ve done those things, just press the “Go” button, wait a few moments, and then browse the results. This image shows what the results look like:

Any row in the results that shows the “Browse” and “Delete” links indicates that the search string was found in that database table. When you click Browse, phpMyAdmin will show you the relevant results.

FWIW, many of my tables have 30,000+ records in them, and this result came back in less than five seconds.


In summary, if you need to search an entire MySQL database and all of its tables for a string, this approach works well for me.