hello Martin
see what grants the root user has by using this query should list the accounts privileges with Y or N the privileges might do more then whats based on their name so look through the manual if the privilege is not enabled.
select * from mysql.user where user = 'root' and host = 'localhost';
there's a grant column so the root user might not have it enabled.
there is also the global_grant privilege table if an variable is not enabled look into that variable to see if it is connected with the giving of grants / privileges to another account.
select * from mysql.global_grants where user = 'root' and host = 'localhost';
The optional WITH clause is used to enable a user to grant privileges to other users. The WITH GRANT
OPTION clause gives the user the ability to give to other users any privileges the user has at the
specified privilege level.
You cannot grant another user a privilege which you yourself do not have; the GRANT OPTION
privilege enables you to assign only those privileges which you yourself possess.
or you have to identify the password for the root user to change its privileges so not adding IDENTIFIED BY 'password' for the root might be why its throwing that error because Error 1045 is a MySQL error code that indicates a failed connection to the MySQL database server.
links on the error
https://www.databasestar.com/access-denied-for-user-root-at-localhost/
https://techyaz.com/mysql/how-to-fix-sql-error-1045-resolving-access-denied-issues/
regards
Zach Ellis