I use Ubuntu 16.04 with Bash and I tried to run the following command set to automatically create a WordPress wp-config.php file with the WordPress Bash extension WP-CLI. Yet I'm having some problem I miss (Bash related?).
loh="127.0.0.1"
drt="/var/www/html"
domain="example-xyz.com"
dbuserp_1="example-xyz.password"
rm -rf "$drt/$domain"/ 2>/dev/null
wp core download --path="$drt/$domain" --allow-root
wpConfig() {
rm -rf "$drt/$domain"/ 2>/dev/null
wp core download --path="$drt/$domain" --allow-root
wp config create \
--path=${drt}/${domain} \
--dbname=${domain} \
--dbuser=${domain} \
--dbpass=${dbuserp_1} \
--dbhost=${loh} \
--allow-root
}
wpConfig
I double checked that the DB user password I use is correct.
And yet, I get this error:
ERROR 1045 (28000): Access denied for user 'example-xyz.com'@'localhost' (using password: YES)
Changing all ${x} to "$x" changed nothing.
I fail to understand why I get the above error (what does it have to do with MySQL itself, as this error seem MySQL related).
mysql -u "$domain" -p"$dbuserp_1" "$domain"work with those same variables set? If not, what error do you get?printf "%s %s\n" "$domain" "$dbuserp_1"to check they're set to what you think they are. Look out for any shell special characters,$,`,*`, spaces, etc in them too.