I have read that PHP is obsoleting the MySql functions.
How will we connect to MySql database?
Where did you hear that? I think it would be a great idea, but it's news to me.
It's better to use new mysqli('hostname', 'username', 'password', 'database')
Or (even better) use new PDO('mysql:dbname=database;host=hostname', 'username', 'password')
The new, better way of doing it is to use PDO. You can find pretty of examples on the web if you Google for "php mysql pdo", here is one.