Tutorial: Setting Up a Database
This tutorial shows us how to set up a database inside of MySQLCreating Our First Database
Once we have MySQL properly installed, we will want to use the shell version to make our database. We will need to enter in our password before being able to access the SQL commands and once we have completed that step, we should have access to the client.
Enter password: ***
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.30 MySQL Community Server - GPL
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
In order to create a database, we will be using the CREATE DATABASE command. For our first database, we will name it myFirstDatabase. Altogether, our command on the client should be: CREATE DATABASE myFirstDatabase;
Congrats, we have made our first database! In order to confirm our database is in our system, we can use the command SHOW DATABASES; and it will display a table of all the current databases inside the client. Note that this will be the only SQL syntax we will be using for this tutorial, we will be building our database tables using Quorum.
mysql> CREATE DATABASE myFirstDatabase;
Query OK, 1 row affected (0.03 sec)
mysql> SHOW DATABASES;
+--------------------+
| Database |
+--------------------+
| information_schema |
| myfirstdatabase |
| mysql |
| performance_schema |
| quorum |
| quorumdatabase |
| sakila |
| sys |
| test |
| world |
+--------------------+
10 rows in set (0.04 sec)
mysql>
Say that we created multiple databases (such as the image above) and we want to make sure we are using 'myfirstdatabase.' We can type the command USE database_name such as USE myFirstDatabase; and it will change the database to the one we want. Every time we open MySQL, we will want to type this command so the management tool knows which database to modify.
mysql> USE myfirstdatabase;
Database changed
mysql>
Next Tutorial
In the next tutorial, we will discuss connect a database, which describes how to connect a database inside of quorum studio.