【MySql】Change the root password
At the initial start up of the server, the following happens, given that the data directory of the server is empty:
- The server is initialized.
- SSL certificate and key files are generated in the data directory.
- validate_password is installed and enabled.
A superuser account ‘root’@’localhost is created. A password for the superuser is set and stored in the error log file. To reveal it, use the following command:
shell> sudo grep 'temporary password' /var/log/mysqld.log
Change the root password as soon as possible by logging in with the generated, temporary password and set a custom password for the superuser account:
shell> mysql -uroot -p
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!'; #Don't miss ‘;’
Note
validate_password is installed by default. The default password policy implemented by validate_password requires that passwords contain at least one upper case letter, one lower case letter, one digit, and one special character, and that the total password length is at least 8 characters.
还没有评论,来说两句吧...