MySQL cannot log on after creating a new user, prompting Access denied for user ' username ' @ ' localhost ' (using password:yes), mostly because of the presence of anonymous users, To resolve this problem, simply delete the anonymous user in the database.
MySQL cannot log on after creating a new user, prompting Access denied for user ' username ' @ ' localhost ' (using password:yes) Workaround:
Please use the root account to run the following code from the command line or PHP program
- MySQL creates a new user, username username, password is password, change localhost to% allows the user to log on to all hosts
CREATE USER ' username ' @ ' localhost ' identified by ' password ';
- To authorize this user, this example grants all permissions to the user, and you can change all privileges to a specific permission option.
*. * represents all data tables under all databases, or can be specified as specific database tables
GRANT all privileges on *. * to ' username ' @ ' localhost ' with GRANT OPTION
- Delete the blank account in the database (anonymous account) and execute the following two orders in turn, this step is the core step to solve the problem
DELETE from ' MySQL '. ' User ' WHERE ' user ' = ';
FLUSH privileges;
MySQL cannot log on after creating a new user, prompting Access denied for user ' username ' @ ' localhost ' (using Password:yes)