Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6596975
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:08:56+00:00 2026-05-25T18:08:56+00:00

Is there a mySQL query to search all tables within a database? If not

  • 0

Is there a mySQL query to search all tables within a database?

If not can you search all tables within a database from the mySQL workbench GUI?

From phpmyadmin there’s a search panel you can use to select all tables to search through. I find this super effective since magento, the ecommerce package I’m working with has hundreds of tables and different product details are in different tables.

enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T18:08:57+00:00Added an answer on May 25, 2026 at 6:08 pm

    If you want to do it purely in MySQL, without the help of any programming language, you could use this:

    ## Table for storing resultant output
    
    CREATE TABLE `temp_details` (
     `t_schema` varchar(45) NOT NULL,
     `t_table` varchar(45) NOT NULL,
     `t_field` varchar(45) NOT NULL
    ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
    
    ## Procedure for search in all fields of all databases
    DELIMITER $$
    #Script to loop through all tables using Information_Schema
    DROP PROCEDURE IF EXISTS get_table $$
    CREATE PROCEDURE get_table(in_search varchar(50))
     READS SQL DATA
    BEGIN
     DECLARE trunc_cmd VARCHAR(50);
     DECLARE search_string VARCHAR(250);
    
     DECLARE db,tbl,clmn CHAR(50);
     DECLARE done INT DEFAULT 0;
     DECLARE COUNTER INT;
    
     DECLARE table_cur CURSOR FOR
     SELECT concat('SELECT COUNT(*) INTO @CNT_VALUE FROM `',table_schema,'`.`',table_name,'` WHERE `', column_name,'` REGEXP ''',in_search,''';')
     ,table_schema,table_name,column_name
     FROM information_schema.COLUMNS
     WHERE TABLE_SCHEMA NOT IN ('information_schema','test','mysql');
    
     DECLARE CONTINUE HANDLER FOR NOT FOUND SET done=1;
    
     #Truncating table for refill the data for new search.
     PREPARE trunc_cmd FROM "TRUNCATE TABLE temp_details;";
     EXECUTE trunc_cmd ;
    
     OPEN table_cur;
     table_loop:LOOP
     FETCH table_cur INTO search_string,db,tbl,clmn;
    
     #Executing the search
     SET @search_string = search_string;
     SELECT search_string;
     PREPARE search_string FROM @search_string;
     EXECUTE search_string;
    
    
     SET COUNTER = @CNT_VALUE;
     SELECT COUNTER;
    
     IF COUNTER>0 THEN
     # Inserting required results from search to table
     INSERT INTO temp_details VALUES(db,tbl,clmn);
     END IF;
    
     IF done=1 THEN
     LEAVE table_loop;
     END IF;
     END LOOP;
     CLOSE table_cur;
    
     #Finally Show Results
     SELECT * FROM temp_details;
    END $$
    DELIMITER ;
    

    Source: http://forge.mysql.com/tools/tool.php?id=232

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a way to query a MySQL database that gives me all blobs
Is there an easy way to run a MySQL query from the Linux command
Is there a way to do a mysql database query in Corel Draw 13(X3)?
I do have 8 tables. when a query fires from search page data from
is there an if statement when it comes to mysql query statements? when i
I am having trouble with the following MYSQL query and are hoping that there
Using standard mysql functions is there a way to write a query that will
Is there analog og the MySQL's time_to_sec() ? I heed to perform query like
I am planning to implement database search through a website - I know there
I've been inserting some numbers as INT UNSIGNED in MySQL database. I perform search

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.