Sometimes it’s convenient to retrieve the user creation statement
and to copy it to another server.
However, with the new authentication method used as default since
MySQL 8.0, caching_sha2_password
, this can become a
nightmare as the output is binary and some bytes can be hidden or
decoded differently depending of the terminal and font used.
Let’s have a look:
If we cut the create user statement and paste it into another
server what will happen ?
We can see that we get the following error:
ERROR: 1827 (HY000): The password hash doesn't have the expected format.
How could we deal with that ?
The solution to be able to cut & paste the authentication
string without having any issue, is to change it as a binary
representation (hexadecimal) like this:
And then replace the value in the user create statement:
But there is an easier way. …
[Read more]