Web Hosting Talk







View Full Version : Ensim SQL command


Acronym BOY
08-23-2002, 10:46 AM
When Ensim creates a site, what is the command it uses to create the SQL database and the user for it?

I could do it by hand in phpMyAdmin, but I just want to know what command it uses.

Thanks!

anantatman
08-24-2002, 04:12 AM
create database db_name

Acronym BOY
08-24-2002, 09:13 AM
nevermind, found it.

#!/bin/sh

if [ $# != 3 ]; then
echo "usage: `basename $0` db user password"
exit 1
fi

DB=$1
USER=$2
PASS=$3

mysql -u root -p <<!
create database $DB;
flush privileges;
grant all on ${DB}.* to ${USER}@localhost identified by "${PASS}" with grant option;
!

cat <<!
Database $DB created
User: $USER
Pass: $PASS
!

http://ensim.webscorpion.com/modules.php?name=News&file=article&sid=3

anantatman
08-24-2002, 09:56 AM
yep, all thats doing is taking arguments 1,2,3 (dbname, username, and pass)

creating the database
and then assigning the permisions to that user:pass

Acronym BOY
08-24-2002, 10:17 AM
what good is a database with out permissions though? ;)

combs
08-24-2002, 11:58 AM
But you are using Grant command to give permissions...there are options in it to give permission settings.