It seems permission issue for usr "sam" in your database.
You should check mysql.users table and provide necessary permissions, if you are trying to access from remote server, you should add IP address of remote server in users table with username ="sam"