I have an MPTT tree of over 100,000 records stored in MySQL using lft, rght and parent_id columns. Now the left/right values became co         
        
In all solutions provided, I was getting a problem where MySQL would prompt that it would be Running query for hours but nothing would happen.
I then realized that if I set the lft and rght values to 1 and 2 in the first record of the tmp_tree table (the one with parent_id = 0), everything worked fine. Maybe the procedure needs updating to do this automatically.