Creating a database

In this section, you will learn about a creating new database in MySQL. We are going to use this database throughout this chapter. Create the script mysql_02.sh to create the database:

#!/bin/bash 
mysql -u root -pTraining2@^ <<MY_QUERY 
create database testdb; 
MY_QUERY 

Now save the program and run it as follows:

 $ chmod +x mysql_02.sh $ ./mysql_02.sh

Get Learning Linux Shell Scripting - Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.