3👍
You are just echoing the whole string.
But you want to echo the first part into the pipe to mysql.
Remove the last "
and place it between ;
and |
.
Example for first line:
run('echo "GRANT ALL ON %s.* TO \'%s\'@\'%s\' IDENTIFIED BY \'%s\';" | mysql --user=%s --password=%s' ....
Source:stackexchange.com