Categories Tree in mysql

Solution for Categories Tree in mysql
is Given Below:

I have this table:

[MyTable][1]
[1]: https://i.stack.imgur.com/SFV5Q.png

I need to view it as tree by MySQL, in SQL Server I success, but in MySQL I didn’t find any solution.
I need it as the following:
[Result][2]
[2]: https://i.stack.imgur.com/TeIfb.png

Thank you

I solved it:

WITH RECURSIVE Tree (CategoryID, CategoryName, ParentCategoryID, _path) AS
(
  SELECT CategoryID, CategoryName, ParentCategoryID, CAST(CategoryID AS CHAR(200))
    FROM productscategories
    WHERE ParentCategoryID = -1
  UNION ALL
  SELECT c.Categoryid, c.Categoryname, c.ParentCategoryID, CONCAT(c2._path, ',', c.Categoryid)
    FROM Tree AS c2
    JOIN productscategories AS c ON c2.Categoryid = c.ParentCategoryID
)
SELECT * FROM Tree ORDER BY _path;