How to find Rank of row in MySQL
This what you are looking for?:

SELECT  @rank := @rank + 1 AS 'Rank', province, city, population
    FROM  canada
    JOIN  ( SELECT  @rank := 0 ) AS init
    WHERE  population &gt; 0
    ORDER BY  province, city, population DESC;


+------+----------+---------------+------------+
| Rank | province | city          | population |
+------+----------+---------------+------------+
|    1 | Alberta  | Airdrie       |      24673 |
|    2 | Alberta  | Athabasca     |       2539 |
|    3 | Alberta  | Banff         |       7502 |
|    4 | Alberta  | Barrhead      |       4430 |
|    5 | Alberta  | Bassano       |       1388 |
|    6 | Alberta  | Beaverlodge   |       2219 |
|    7 | Alberta  | Black Diamond |       3663 |
|    8 | Alberta  | Blackfalds    |       3198 |
|    9 | Alberta  | Blairmore     |       2095 |
|   10 | Alberta  | Bon Accord    |       1611 |
|   11 | Alberta  | Bonnyville    |       6003 |
|   12 | Alberta  | Bow Island    |       1792 |
|   13 | Alberta  | Brooks        |      12745 |
|   14 | Alberta  | Calgary       |     968475 |
|   15 | Alberta  | Calmar        |       2000 |
|   16 | Alberta  | Camrose       |      15687 |
...
|  708 | Saskatchewan              | Wilkie                    |       1198 |
|  709 | Saskatchewan              | Wynyard                   |       1793 |
|  710 | Saskatchewan              | Yorkton                   |      15172 |
|  711 | Yukon                     | Haines Junction           |       1148 |
|  712 | Yukon                     | Mayo                      |        540 |
|  713 | Yukon                     | Whitehorse                |      19616 |
+------+---------------------------+---------------------------+------------+


Or you can upgrade to MySQL 8.0 or MariaDB 10.2 to get CTEs and Windowing functions.