You don't, well technically you can, but there's a better way in my mind to store avatars. Simply upload them to a writeable directory (and be sure to check their name for validity: ensure to remove and null characters) and rename them to the user's name. You can also rewrite the writeable directory so that the URL to access a user's picture.
If you absolutely insist on storing an image in a MySQL database,
check out this tutorial on PhpRiot.