I have a problem i want to give a password for the user root of MySQL, in bash the command line is :

command echo "SET PASSWORD FOR 'root'@'${HOSTNAME}' = PASSWORD('${PASSWD}')" | command mysql --user=root

In a shell it works perfectly, but not in bitrock, so i tried :

        <programArguments>"SET PASSWORD FOR 'root'@'' = PASSWORD('${mysqlrootpasswd}')" | mysql --user=root</programArguments>
        <programArguments>"SET PASSWORD FOR 'root'@'${machine_hostname}' = PASSWORD('${mysqlrootpasswd}')" | mysql --user=root</programArguments>
        <programArguments>-u root password "${mysqlrootpasswd}"</programArguments>

But that not resolve the problem...

The error dispayed :

Error in echo "SET PASSWORD FOR 'root'@'host' =
PASSWORD('passwd')" | mysql --user=root : ERROR 1133 (42000) at line 1: Can't find
any matching row in the user table

Any ideas?


Plateform : Debian Squeeze

asked 02 Aug '12, 04:39

mrinco's gravatar image

accept rate: 50%

According to the error it seems the first command succeeded ('root'@'') but the second one failed ('root'@'${machine_hostname}'). I machine_hostname resolving to "host"? Is that the same value you are using in the command line successfully?

(02 Aug '12, 05:36) juanjo ♦♦

Ok i found a solution!


answered 02 Aug '12, 09:05

mrinco's gravatar image

accept rate: 50%

Yes it's true, the first command succeeded ('root'@''), It don't work because the ${machine_hostname} variable add a suffix dns (.local) after the hostame... so i need to set up a variable without the suffix ... How can i do that?


answered 02 Aug '12, 07:35

mrinco's gravatar image

accept rate: 50%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: 02 Aug '12, 04:39

Seen: 2,792 times

Last updated: 02 Aug '12, 09:05