Cannot connect through network

It’s exactly as for any MySQL server: you need username+password depending on how your MySQL server is configured. So if there is no password for root, don’t use one.

Please try to add some error_log to catch the parameters passed to the MySQL PHP API code.