The Retained Earnings etc. account definition moves from the global setup when you switch on the Company G/L segment. Those global G/L accounts are then defined for each Company in the Company setup page.
Make sure your G/L account structure is consistent across all companies. So 01-1000 might equal Revenue for company 01, and 02-1000 would also equal Revenue but for company 02. 01-3000 and 02-3000 might be General Expenses for each company.
Set up each company in different databases (I would make the database name the same (or similar) to the company actual name). Set up the G/L Ledger in each database according to the company it represents (you don’t need the consolidated G/L ledger in each database). In a third database set up the Consolidated G/L and you will see options for connecting to the company databases in order to import transactions.
Bear in mind the import only brings in the Company transactions and does not perform any sort of inter-company elimination