Searching Through a Database with PhpMyAdmin

Reading Time: 3 minutes

Using PhpMyAdmin to search for records and information in your database can quickly help you get the information you need without having to run advanced search queries. This tutorial assumes you have already logged in to PhpMyAdmin, and shows how to search by keyword and for a range of records.

First, from the main PhpMyAdmin screen, we can click on the database name from the left navigation menu. In this example, we selected the lwtest_wpdb database which is a test WordPress database taken from a live site.

03-01-Home_Page

We then clicked on the Search tab at the top of the PhpMyAdmin page

03-02-Database-Search-Tab

As we can see from the image below, this is a general keyword search. We will put “test” in the search box to show the basic functionality, but the other options under “Find” can also show records with multiple search terms. This will search for the exact string that is entered, or we can even use regular expressions to search. Using the table box seen below, we can select the tables we want to search through, or just click on “Select all” to search through all the tables in the database. Then we can click on the Go button in the lower right of the page to start the search.

03-03-Database-Test-Search

The results page shows us the number of matches that were in each table we searched through. For the tables that had the search, term we can click on Browse to view the results. We will click on Browse for the wp_options table, and see the 4 matches our search returned.

03-04-Browse-Search-Results

The page below shows the actual query that PhpMyAdmin used to get the results. If we wanted to run the query manually or tweak the search further we can copy the query from there. After that, it shows the table with each record that had “test” in it. One important thing to note, the query matched “test” when it was found in both uppercase, lowercase, and the word “Testing”. Our query even listed the two results found in the email address and it still only counted that result as one record.

03-05-Matching-Records

Next, we can search for a range of data by using the table’s Search tab. We then click on the table name we want to search from the databases in the left-hand navigation, in this case, we will search the wp_comments table. We then clicked on the Search tab at the top of this page.

03-06-Table-Search-Tab

The Search tab is different from the database level search as it shows the table columns, what type of data they store, and provides the option to search using different operators.

These options can help us locate a range of data. If we review the search options for the comment_ID field, we can select the < (less than) operator and enter a value of 400. Then we will click on the Go button in the bottom right side to begin our search.

03-07-Table-Search-Parameters

Our results page indicate that 267 records were matched when searching for a comment_ID of less than 400. We can now review those records, Edit, Copy, or Delete the records we want, or modify the search again and continue searching!

03-08-Table-Search-Results

Conclusion

From the PhpMyAdmin interface we can quickly search through databases for specific data and ranges easily via a browser window. This is much easier compared to running queries manually via the command line.

Additionally, the search results provided allow for easy editing, copying, and removal as well. PhpMyAdmin also displays the queries it uses to perform the search actions. This can also be used as a learning tool or reference to write or create a new query that can be used at a later date.

Series Navigation<< Previous ArticleNext Article >>

Author Bio

About the Author: Alex Gorzen

Alex Gorzen has been helping others with technology his whole life. He played with computers even before he could read and wants to make sure his children share that same love as they grow up. In his free time he enjoys gardening, building things, and learning new skills.

Refer a friend and get hosting credit!