Here's something you can try: You can re-write the functions using mysqli_*.
This is just a starting point!
<?php
    if(!function_exists('mysql_connect') && function_exists('mysqli_connect'))
    {
        $_GLOBALS["\0MYSQL"] = array();
        function mysql_connect($servername, $username, $password)
        {
            $_GLOBALS["\0MYSQL"][] = mysqli_connect($servername, $username, $password);
        }
        function mysql_select_db($database_name)
        {
            return mysqli_select_db(end($_GLOBALS["\0MYSQL"]), $database_name);
        }
        [...]
    }
This is just a proof-of-concept and is meant to exemplify what I mean.
I'm not sure if someone already wrote this, and my Google-fu is terrible.
Also, don't forget to define all the constants that you use from mysql_*.
Hope this helps.