0

My issue is that this:

mysql -u root -p newdb -e "UPDATE newdb_users SET user_login='newuser', user_pass='$P$BJ7HEXzUXBqB74hw0H9KD2QvdnlwGv1' WHERE user_login='admin';"

does not update the "user_pass" field, but entering this:

UPDATE newdb_users SET user_login='newuser', user_pass='$P$BJ7HEXzUXBqB74hw0H9KD2QvdnlwGv1' WHERE user_login='admin';

directly in the MySQL console does. What am I missing?

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by rch1231
0

You have a -p flag for the password but nothing entered. If there is a root password then it should be prompting you. If there is not one remove the -p. You also should have a -D in front of database like this:

mysql -u root -ppassword -D newdb -e "UPDATE newdb_users SET user_login='newuser', user_pass='$P$BJ7HEXzUXBqB74hw0H9KD2QvdnlwGv1' WHERE user_login='admin';"

OR you can do this:

mysql -u root -p -e "use newdb \; UPDATE newdb_users SET user_login=\'newuser\', user_pass=\'$P$BJ7HEXzUXBqB74hw0H9KD2QvdnlwGv1\' WHERE user_login=\'admin\'\;"

You may also need the backslash in from of special characters like in the second example to tell the shell to ignore the normal use of the next character.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.