PHP can not connect to Database [closed]

Mysql Version 5.1.73

I am able to connect to the mysql database from the shell with this commmand

mysql -u medit_login -p

I enter my password and I receive the welcome to the MySQL monitor.

Your MySQL connection id is 5 
Server version 5.1.73 Source Distribution.
mysql>

When I try to login from php I receive cannot connect to Database.

I have tried many times to give permissions with this command:

GRANT ALL PRIVILEGES on markdb.* TO 'medit_login'@'%' IDENTIFIED BY 'password';

Is version 5.1.73 looking for an encryption password?

Answer

Issue was firewall the port was after the reject and that was the reason of failure.