Please can you paste line 6, to check that you are querying the database properly.
You should never ever ever try to connect to MySQL as root from a script (unless you absolutely have to - for example, to add new SQL users).
Check MySQL is running, etc etc. Try opening a shell to MySQL, and check that you can query the database okay from there.
Cheers
--
Please contact me at:
Colin (dot) Horne (at) gmail (dot) com
My blog:
http://colinhorne.blogspot.com