We have successfully created a database named testdb and a user named user1, and have also granted all of the privileges on the testdb database.
Now we will create a table. Create the script mysql_05.sh to list the table:
#!/bin/bash mysql -u user1 -pTest623@! <<MY_QUERY use testdb; show tables; MY_QUERY
Now save the program and run it as follows:
$ chmod +x mysql_05.sh $ ./mysql_05.sh
The preceding command will not show presence of any table, as we only just have created our database.
Now, we are going to create a table named Authors. Create the script mysql_06.sh to create a table named Authors:
#!/bin/bash mysql -u user1 -pTest623@! <<MY_QUERY use testdb; CREATE TABLE Authors(Id INT PRIMARY KEY AUTO_INCREMENT, ...