Set a password for the root user of MySQL

Windows root user in a new installation of MySQL does not have a password, use the command line by typing directly mysql -uroot -penter to enter the mysql command-line interface. But we want to add a password for the root user how to do it?

  • After the search has found use in the MySQL command line
set password for [email protected] = password("密码")

To establish methods for the root password, but after I test error, useless.

  • Then I used another way: If your MySQL bin directory has been placed in an environment variable, you can type the console command line mysqladmin -uroot -p password 密码to set up the root password, type set up after the success mysql -uroot -pwill prompt you to type a password, enter your previous new set up the root password, enter the MySQL command line interface to start learning it!

Guess you like

Origin www.cnblogs.com/ahaolee/p/11140677.html