How do I connect to a database with a blank password using a shell script?
If root has no password you could just do this:
mysql -u$USER database_name &lt; backup.sql

If you want to code so that root can be given a password later, do this in the script
USER=&quot;root&quot;
PASS=&quot;&quot;
if [ &quot;${PASS}&quot; == &quot;&quot; ]
then
    PASSWORD=&quot;&quot;
else
    PASSWORD=&quot;-p${PASS}&quot;
fi
mysql -u${USER} ${PASSWORD} database_name &lt; backup.sql

Give it a Try !!!
CAVEAT
If is usually not a good idea to have root without a password. Please give it one.