I am attempting to automate the creation of MySQL users -- So I am building a bash
cron that will create them on the fly. The problem is, that when I create them, I am using a random password generation which can include characters such as ^
$
%
etc etc ..
Using the following fails:
create_database=$(mysql --login-path=local -se "CREATE USER IF NOT EXISTS 'user'@'localhost' IDENTIFIED BY '1234!!ABC^@DEFGH';")
Whereas the following succeeds:
create_database=$(mysql --login-path=local -se "CREATE USER IF NOT EXISTS 'user'@'localhost' IDENTIFIED BY '1234';")
Is it the CLI or bash
script that doesn't like the password, or is it MySQL that doesn't like it? Is there a work-around? I'd like to do this in bash vs a scripting language like PHP/PERL