Hello,

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 :

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

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?

Thanks!

Plateform : Debian Squeeze

asked 02 Aug '12, 04:39

mrinco's gravatar image

mrinco
0457
accept rate: 50%

According to the error it seems the first command succeeded ('root'@'127.0.0.1') 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!

<setInstallerVariableFromScriptOutput>
    <exec>cat</exec>
    <execArgs>/etc/hostname</execArgs>
    <name>host</name>
</setInstallerVariableFromScriptOutput>
link

answered 02 Aug '12, 09:05

mrinco's gravatar image

mrinco
0457
accept rate: 50%

Yes it's true, the first command succeeded ('root'@'127.0.0.1'), 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?

link

answered 02 Aug '12, 07:35

mrinco's gravatar image

mrinco
0457
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

By RSS:

Answers

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

Tags:

×73
×15
×12
×9
×8
×5

Asked: 02 Aug '12, 04:39

Seen: 2,792 times

Last updated: 02 Aug '12, 09:05