Database Reference
In-Depth Information
Note
Create, Then Populate You must run the table creation scripts
before
the table popula-
tion scripts. Be sure to check for any error messages returned by these scripts. If the
creation scripts fail, you need to remedy whatever problem might exist before continuing
with table population.
Caution
One Or the Other, Not Both Both of the following sets of instructions do the exact
same thing, so pick one and use it, but don't try to use both. (You'll not be able to cre-
ate the same database and tables twice.)
To create the example data using the
mysql
command line utility, do the
following:
1.
Make sure MariaDB is running.
2.
Open a command prompt window, and go to the
bin
folder under the
MariaDB installation folder.
3.
Connect to MariaDB as the
root
user (so that you have the security
access needed to create a new database). Type
mysql -u root
and
press Enter. If you specified a root password at installation time, use
mysql -u root -p
and press Enter, and then type the password when
prompted to do so.
4.
You should see a prompt like
MariaDB [(none)]>
. The name of the
currently selected database is displayed inside the square brackets, and
(none)
simply means that no database has been selected.
5.
To keep the tables used in this topic separate from any other work or
data, we create a new database and use that exclusively for all chapters.
Type
create database crashcourse;
(don't forget the
;
) and press
Enter to create a new database named
crashcourse
. You should see a
message saying
OK
.
6.
Next you need to select the new database (so that when you create
the tables they are created inside it). Type
USE crashcourse;
and press
Enter. The prompt should now indicate that the
crashcourse
database
has been selected.