There are a few general recommendations to prevent this in future:
a) Install all updates regularily. I check at least one one of my servers every few days, If i see that there are updates available, I login to every server and install the updates.
b) Try to protect phpmyadmin, the following options might help:
- Add a robots.txt in the phpmyadmin filder which denies spidering, so your phpmyadmin install is not listed in the major search engines.
- Dont name the phpmyadmin folder phpmyadmin.
- The ultimate but not always usable method to secure phpmyadmin is to add a password protection with a .htaccess file.