Name
mysql_find_rows
Synopsis
mysql_find_rowsoptions
filename
This utility searches a text file containing SQL statements
(e.g., a dump file generated by mysqldump
) for a
given pattern and prints the SQL statements it finds. Multiple files may
be specified in a comma-separated list:
mysql_find_rows --regexp='Graham Greene' < backup.sql > greene_sql_ statements.txt
In this example, the utility will search the dump file
backup.sql (the redirect for the input is optional)
for occurrences of the name of the writer Graham
Greene. It will write the
results—the SQL statements it finds that contain that text—to
the greene_sql_statements.txt
file because of the redirect (i.e., >
). Otherwise,
the results would be displayed on the screen. When creating a dump file
that you want to search with this utility, you may want to avoid the
--extended-insert
option (or use
--skip-opt
to disable it) because that option leaves
a single INSERT
statement in the dump file for all
rows in the entire table. Your search with this utility would then show
all rows for the table, as it returns the whole SQL statement containing
the search pattern.
mysql_find_rows options
--help
This option displays help information about the utility.
--regexp=
pattern
This option specifies the pattern on which the utility is to search the given text file. The pattern is usually entered between quotes. If the option is not given, then the utility will search for
SET
andUSE
statements.--rows=
number
This option limits the number of rows of ...
Get MySQL in a Nutshell, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.