echo -e " -p PASS database password. 'No password' by default. Prompts if DB access fails"
echo -e " -P PORT database port. '$DBPORT' by default"
echo -e " -h HOST database host. '$DBHOST' by default"
-# echo -e " -d NAME database name. '$DBNAME' by default. Prompts if DB access fails"
+ echo -e " -d NAME database name. '$DBNAME' by default. Prompts if DB access fails"
echo -e " --help shows this help"
}
-while getopts ":u:p:P:h:-:" o; do
+while getopts ":u:p:P:d:h:-:" o; do
case "${o}" in
u)
DBUSER="$OPTARG"
P)
DBPORT="$OPTARG"
;;
-# d)
-# DBNAME="$OPTARG"
-# ;;
+ d)
+ DBNAME="$OPTARG"
+ ;;
h)
DBHOST="$OPTARG"
;;
#${DIRNAME}/quick_delete_db.sh $MUSER $MPASS $MDB $HOST $PORT
echo " loading ${DIRNAME}/${DBNAME}_structure.sql"
-mysql $DBHOST_ $DBPORT_ $DBUSER_ $DBPASS_ < ${DIRNAME}/${DBNAME}_structure.sql
+mysql $DBHOST_ $DBPORT_ $DBUSER_ $DBPASS_ $DBNAME < ${DIRNAME}/mano_db_structure.sql
echo " migrage database version"
${DIRNAME}/migrate_mano_db.sh $DBHOST_ $DBPORT_ $DBUSER_ $DBPASS_ -d$DBNAME
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
---
--- Current Database: `mano_db`
---
-
-/*!40000 DROP DATABASE IF EXISTS `mano_db`*/;
-
-CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mano_db` /*!40100 DEFAULT CHARACTER SET latin1 */;
-
-USE `mano_db`;
-
--
-- Table structure for table `datacenter_nets`
--
echo "GRANT ALL PRIVILEGES ON mano_db.* TO 'mano'@'localhost';" | mysql -u$DBUSER $DBPASSWD_PARAM -s || ! echo "Failed while creating user mano at dabase" || exit 1
echo " Database 'mano_db' created, user 'mano' password 'manopw'"
-su $SUDO_USER -c 'openmano/database_utils/init_mano_db.sh -u mano -p manopw' || ! echo "Failed while creating user mano at dabase" || exit 1
+su $SUDO_USER -c 'openmano/database_utils/init_mano_db.sh -u mano -p manopw -d mano_db' || ! echo "Failed while creating user mano at dabase" || exit 1
if [ "$_DISTRO" == "CentOS" -o "$_DISTRO" == "Red" ]
then