mysql db,user ÀÚµ¿ »ý¼º ½©½ºÅ©¸³Æ® |
±Û ¾´ ÀÌ |
linux |
³¯ Â¥ |
2003³â 03¿ù 21ÀÏ 22½Ã 57ºÐ 37ÃÊ |
º» ¹® |
#!/bin/sh
ROOTPASS="passwd"
echo -n "ID: "
read ID
echo -n "PASSWD: "
read PASS
echo -n "DATABASE NANE: "
read DNAME
MYSQL="/usr/local/mysql/bin/mysql"
echo "insert into user values('localhost','${ID}',password('${PASS}'),('n','n','
n','n','n','n','n','n','n','n','n','n','n','n');" > /tmp/useradd.sql
echo "create database ${DNAME};" >> /tmp/useradd.sql
echo "insert into db values('%','${DNAME}','${ID}','y','y','y','y','y','y','y'
,'y','y','y');" >> /tmp/useradd.sql
echo "flush privileges;" >> /tmp/useradd.sql
$MYSQL -uroot -p${ROOTPASS} mysql < /tmp/useradd.sql
rm -rf /tmp/useradd.sql
|
|
|
|