I Have an access to MYSQL Server with more than 2000 Databases in it. I want to scan all databases to get all email addresses that saved in the tables of databases.
So would you please give me a solution to extract email address from all of databases !?
I already have a root privileges and phpmyadmin.
Thank you
If you have access to all tables (i.e. as root), you can dump all tables and grep email address, like this:
mysqldump -u root -p --all-database | egrep -i "\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b"
The regular expression I used is taken from here: http://www.regular-expressions.info/email.html
Edit: the command above will print the whole rows containing an email address regardless of the column. If you have email dedicated columns you can print only email with a little modification:
mysqldump -u root -p --all-database | perl -pe "s/,/\n/g; s/'//g;" | egrep -i "\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b"
This will remove also surrounding quotes.