Why does WordPress get posts from MySQL from a virtual hostname but not the direct hostname?

I was able to solve this problem—it turns out that WordPress behaves better when I set both the WordPress address and the site address to http://localhost/~Gabe/mysite.dev/.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)