Simó Albert i Beltran

mysql-create-user-and-db

Simó Albert i Beltran at

I am annoyed each time I need a mysql user and the related database. So, I created a little script.

https://gitorious.org/sim6/mysql-create-user-and-db/source/master:mysql-create-user-and-db

Enjoy it!

Francisco M García Claramonte likes this.

nice idea :)

proposed patch:

--- mysql-create-user-and-db.orig   2014-04-14 21:40:58.819590301 +0200
+++ mysql-create-user-and-db    2014-04-14 21:41:16.103589683 +0200
@@ -18,20 +18,20 @@
 # along with this program. If not, see <http://www.gnu.org/licenses/>.
 #

-if [ -z $1 ]
+if [ -z "$1" ]
 then
    echo "Usage: $0 &lt;user_app&gt; [&lt;pass&gt;]"
    exit 1
 fi

-NAME=$1
+NAME="$1"

-if [ -z $2 ]
+if [ -z "$2" ]
 then
    PASS=$(pwgen 20 1)
    echo Password: $PASS
 else
-   PASS=$2
+   PASS="$2"
 fi

 echo "

gregor herrmann at 2014-04-14T19:44:44Z