Category tree, brute force

SELECT
  d.id,
  d.name,
  CONCAT_WS(' -> ',c5.name,c4.name,c3.name,c2.name,c1.name) as cat_string
FROM domain d
  LEFT JOIN category c1
    ON c1.id = d.category_id
  LEFT JOIN category c2
    ON c1.parent_id = c2.id
  LEFT JOIN category c3
    ON c2.parent_id = c3.id
  LEFT JOIN category c4
    ON c3.parent_id = c4.id
  LEFT JOIN category c5
    ON c4.parent_id = c5.id;