1.搜索数据库:mysqlmetagrep
mysqlmetagrep --pattern="%test%" --server=root:rootroot@192.168.1.51:3306
1.数据库,表,视图等名称中有:test的内容。
[root@mysql1 ~]# mysqlmetagrep --pattern="%test%" --server=root:rootroot@192.168.1.51:3306
WARNING: Using a password on the command line interface can be insecure.
+---------------------------+--------------+-------------------+-----------+-------------+-------------------+
| Connection | Object Type | Object Name | Database | Field Type | Matches |
+---------------------------+--------------+-------------------+-----------+-------------+-------------------+
| root:*@192.168.1.51:3306 | SCHEMA | test | test | DATABASE | test |
| root:*@192.168.1.51:3306 | SCHEMA | test2 | test2 | DATABASE | test2 |
| root:*@192.168.1.51:3306 | TABLE | latest_file_io | sys | TABLE | latest_file_io |
| root:*@192.168.1.51:3306 | TABLE | x$latest_file_io | sys | TABLE | x$latest_file_io |
| root:*@192.168.1.51:3306 | TABLE | test1 | test | TABLE | test1 |
| root:*@192.168.1.51:3306 | TABLE | test2 | test | TABLE | test2 |
| root:*@192.168.1.51:3306 | TABLE | test3 | test | TABLE | test3 |
| root:*@192.168.1.51:3306 | TABLE | test1 | test2 | TABLE | test1 |
| root:*@192.168.1.51:3306 | VIEW | latest_file_io | sys | VIEW | latest_file_io |
| root:*@192.168.1.51:3306 | VIEW | x$latest_file_io | sys | VIEW | x$latest_file_io |
+---------------------------+--------------+-------------------+-----------+-------------+-------------------+
2.仅查看对象类型为:TABLE的内容。
mysqlmetagrep --search-objects=table --pattern="%itpux%" --server=root:rootroot@192.168.1.51:3306
[root@mysql1 ~]# mysqlmetagrep --search-objects=table --pattern="%test%" --server=root:rootroot@192.168.1.51:3306
WARNING: Using a password on the command line interface can be insecure.
+---------------------------+--------------+-------------------+-----------+-------------+-------------------+
| Connection | Object Type | Object Name | Database | Field Type | Matches |
+---------------------------+--------------+-------------------+-----------+-------------+-------------------+
| root:*@192.168.1.51:3306 | TABLE | latest_file_io | sys | TABLE | latest_file_io |
| root:*@192.168.1.51:3306 | TABLE | x$latest_file_io | sys | TABLE | x$latest_file_io |
| root:*@192.168.1.51:3306 | TABLE | test1 | test | TABLE | test1 |
| root:*@192.168.1.51:3306 | TABLE | test2 | test | TABLE | test2 |
| root:*@192.168.1.51:3306 | TABLE | test3 | test | TABLE | test3 |
| root:*@192.168.1.51:3306 | TABLE | test1 | test2 | TABLE | test1 |
+---------------------------+--------------+-------------------+-----------+-------------+-------------------+
3.总结
mysqlmetagrep 工具可以同时查看TAB.VIEW,SCHEMA,FUNCTION等。通过模糊查询可以很方便的找到表,视图,数据库名称,函数名称等。四个比较综合性的工具,相对比较实用。特别是急不得表的具体名称。