By default MySQL port is 3307. Some web hosting companies may use different port for better security. If your MySQL port is something other than 3307, then you will need to define that to your wordpress configuration file, as wordpress will try to connect through port 3307.
It’s pretty easy to let wordpress know your MySQL port.
Add DB_HOST attribute like following example (change with your own port):
define('DB_HOST', 'localhost:3307'); //change with your own port
define('DB_HOST', 'mysql.domain.com:3307'); //change with your own port and mysql server location