This might be a matter of PHP attempting to log in to MySQL from a different IP than the user is configured for accessing from. I've run into it where I had 'root' enabled for login from 127.0.0.1, but some stuff was trying to log in from the 192.168.1.X IP address, so MySQL refused it. 
 
I ended up adding a login entry for every permutation of local IP address as a valid location: 127.0.0.1, localhost, 192.168.1.X, ::1, everything. 
		
	
		
		
		
		
		
		
		
		
		
	
		
		
	
	
	 |