2013. 11. 19. 16:57
Style one
mysql --user=mysql_user_ID --password=mysql_user_password database_name << EOF
show tables;
Style two
Result=`mysql -u userId -puserPw --skip-column-names -e "show databases like 'database_name'"`
if [ "$Result" != "database_name" ]; then
echo "Database isn't exist"
else
echo "Database is exist"
fi
'Programming > Bash shell' 카테고리의 다른 글
check wheter mySQL is running in bash shell (0) | 2013.11.20 |
---|---|
check if mysql database exists in bash shell (0) | 2013.11.20 |
optional parameter expansions in bash shell (0) | 2013.11.19 |
Replace string in bash shell (0) | 2013.11.18 |
Bash shell script to swap two number (0) | 2013.11.12 |