And when you use -e you should have it after user and password so the SQL commands you want to execute comes after the -e.
That was a once off artifact of me doing it on this system after the root password has been set.
OK, so maybe this then:sudo mysql -e "CREATE USER [email protected] IDENTIFIED by '$DB_PASS';" sudo mysql -e "GRANT ALL ON $DB_NAME.* TO [email protected];" sudo mysql -e "FLUSH PRIVILEGES;"
right. Updating the guide. but half tempted to leave the single quotes everywhere it that causes no error in order to protect against spaces by others. Though I am using pwgen to to this.
It's kind of f*cked up to have spaces in user names and passwords. Personally I don't use something unless it's specifically needed but either way works.