【MySql】Change the root password

悠悠 2024-02-19 13:23 69阅读 0赞

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:

  1. 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:

  1. shell> mysql -uroot -p
  2. 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.

发表评论

表情:
评论列表 (有 0 条评论,69人围观)

还没有评论,来说两句吧...

相关阅读