Can you clarify the product version you're using? In QuickBooks Online, you'll have to manually add an account number for each one in your Chart of Accounts. It will automatically update history transactions with the generated account numbers.
Go to the Gear icon and select Account and Settings.
Select the Advanced tab.
Click Edit ✎ in the Chart of accounts section.
Select Enable account numbers. If you want account numbers to show on reports and transactions, select Show account numbers.
Select Save and then Done.
Then, follow these steps to assign account numbers:
Go to the Accounting menu and select Chart of Accounts.
If you're using QuickBooks Desktop, I have good news for you. QuickBooks automatically adds account numbers in the Chart of Accounts. Default account numbers are based on Generally Accepted Accounting Principles (GAAP). You can change an account number at any time. Take note that QuickBooks only assigns account numbers to the system-generated accounts.
Follow these steps to turn on this feature:
Go to the Edit menu, then select Preferences.
Select the Company Preferences tab.
Select the Use account numbers checkbox.
If you have subaccounts, select the Show lowest subaccount only checkbox. This shortens the subaccount details when you use them in your transactions.
For example, the expense account 5400 Rent: 5410 Office: 5411 Main shows as 5411 Main when you use it in a check.