posted by Solver Full-stack Developer 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



신고

티스토리 툴바