Moderators: gerski, enjay, williamconley, Op3r, Staydog, gardo, mflorell, MJCoate, mcargile, Kumba, Michael_N
ok so you want to create a sh file that will be executed after
of say same sql queries you want then and i will help you .
#!/bin/bash
echo "welcome to our script"
echo "------------------------"
echo " drop database asterisk if exist"
mysql --user=cron --password=1234 --execute="DROP DATABASE IF EXISTS `asterisk`;"
echo "-----------------------"
echo "create asterisk database"
mysql --user=cron --password=1234 --execute="create database 'asterisk' default character set utf8 collate utf8_unicode_ci;
echo "---------------------------"
echo "use database asterisk"
mysql --user=cron --password=1234 --execute="use 'asterisk';"
echo "---------------------------"
echo" "create table mytable"
mysql --user=cron --password="CREATE TABLE 'mytable' (
'P_Id' int, 'LastName' varchar(255), 'FirstName' varchar(255), 'Address 'varchar(255), 'City' varchar(255) )"
echo "---------------------------"
echo "insert data in table mytable"
mysql --user=cron --password="INSERT INTO 'mytable' ('FirstName', 'Address', 'City') VALUES ('111', '222', '333');"
echo "---------------------------"
echo "bye bye"
#!/bin/bash
echo "Welcome to our script"
echo "------------------------"
mysql -uroot -pvicidialnow -e "use asterisk;CREATE TABLE mytable (P_Id int, LastName varchar(255), FirstName varchar(255), Address varchar(255), City varchar(255))"
echo "---------------------------"
echo "insert data in table mytable"
mysql -uroot -pvicidialnow -e "use asterisk;INSERT INTO mytable(FirstName, Address, City) VALUES ('111', '222', '333')"
echo "---------------------------"
echo "bye bye"
Users browsing this forum: No registered users and 41 guests