How to create a six character password in MySQL 5.7

后端 未结 7 796
星月不相逢
星月不相逢 2021-01-31 11:05

I need to create a user with a six character password in new MySQL on my mac. I know that the lowest setting in 5.7 will allows only eight characters. Is there any way to go aro

7条回答
  •  孤独总比滥情好
    2021-01-31 11:51

    MySQL 5.7+ by default haves a Password validation system. In case if you don't want to go strictly with the policy and need to assign your own then just disable the password validation and restart mysqld process.

    Edit my.cnf file :

    vi /etc/my.cnf
    

    in [mysqld]

    validate-password=off
    

    Save the file and then restart the process

    sudo service mysqld restart
    or
    systemctl restart mysqld
    

    and then change the Root Password using the following and follow the steps it won't throw exception for the Root Password.

    mysql_secure_installation
    or
    /usr/bin/mysql_secure_installation
    

    If you are doing installation for the first time and want to know the temporary password then use the following to find the first time password:

     grep 'temporary password' /var/log/mysqld.log
    

    Let me know your comments on the same, in the below comment box.

提交回复
热议问题