I\'m trying to automate MySQL user creation procedure. I thought of creating a temp file that would contain mysql user creation statements, then I would have call it like this :
Just to answer why the error occurs and to show the differnce:
@password
to be a hash string 1 value:
GRANT ALL PRIVILEGES
ON `mydb` . * TO 'username'@'localhost' IDENTIFIED
BY
PASSWORD '@password';
Note the use of the PASSWORD
keyword!
@password
to be a clear-text string value:
GRANT ALL PRIVILEGES
ON `mydb` . * TO 'username'@'localhost' IDENTIFIED
BY
'@password';
Note the missing PASSWORD
keyword!
SELECT PASSWORD('clearTextPasswd');
- see Snowman's answer for an example.