Previously (MySQL 5.7) we was using this command to add a new email address into an existing table:
INSERT INTO `servermail`.`virtual_users`
(`id`, `domain_id`, `password` , `email`)
VALUES
('1', '1', ENCRYPT('password', CONCAT('$6$', SUBSTRING(SHA(RAND()), -16))), 'user@example.com'),
then dovecot was able to authenticate users. (more information about dovecot password scheme)
Now Encrypt has been deprecated in the recent versions of MySQL. (link)
I want to rewrite that command using SHA2 but I wasn't succeed.
Edit:
This could help someone to use How To Configure a Mail Server Using Postfix, Dovecot, MySQL, and SpamAssassin to configure a Mail Server with version 8.0 of Mysql.
Finally I changed the default method dovecote uses for its user authentication from SHA512-CRYPT
to SHA512
. I think it's not less secure than that but is supported by MySQL 8.
After that I used this command to add a new user to the table.
INSERT INTO `servermail`.`virtual_users`
(`id`, `domain_id`, `password` , `email`)
VALUES
('1', '1', TO_BASE64(UNHEX(SHA2('password', 512))), 'user@example.com');