From the course: Linux System Engineer: Database Servers Using MariaDB

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Subcommands to manage databases

Subcommands to manage databases

From the course: Linux System Engineer: Database Servers Using MariaDB

Start my 1-month free trial

Subcommands to manage databases

- [Instructor] Using the MySQL Shell, we can create and delete databases. Note that it's standard practice to type SQL commands in uppercase to differentiate from other pieces of data. This is the form that I've included in this course, but take note that the lowercase works as well. The subcommand we use for creating a new database inside the interactive shell is simply CREATE. We'll need to specify the database name to create it. To be clear what we're creating, we type CREATE DATABASE followed by the database name. When creating a database, we can also specify the character set and collation. Another way we can create a new database is to put the SQL statements into a file and then redirect it into the MySQL command. On the command line, we'd use the MySQL Shell program followed by the name of the database to populate, and then we'd redirect the SQL file into it. To limit human error, we can include a USE statement inside the SQL file. This way, the administrator doesn't have to…

Contents