When we do the fresh installation of Mysql we got the root user without any password. Keeping and using the root user for application is not safe.
mysql create user and grant all privileges on database
For creating new user use the following commands.
CREATE USER 'wordpressapi'@'localhost' IDENTIFIED BY 'Test@123456'; GRANT ALL ON *.* TO 'wordpressapi'@'localhost';