Database Reference
In-Depth Information
7.
To create the tables, you need to run the
create.sql
script. Make sure
you know the full path to the file and type
\. /path/create.sql
and
press Enter, replacing
path
with the actual path. So, if
create.sql
is in
/downloads/
, type
\. /downloads/create.sql
. You should see a series
of
OK
messages.
Caution
No
;
When Using
\.
Unlike the
CREATE
and
USE
statements (and indeed just about
every MariaDB SQL statement), do not type a trailing
;
when using the
\.
command to
execute an external script file.
8.
Repeat step 7, this time using the
populate.sql
script. This populates
the newly created tables with the sample data. Again, you should see a
series of
OK
messages indicating success.
9.
When you are done, type
exit
or
quit
to exit
mysql
.
You can now return to Chapter 3, “Working with MariaDB.”
To create the example data using MySQL Workbench, do the following:
1.
Make sure MariaDB is running.
2.
Launch MySQL Workbench.
3.
Click on Open Connection to Start Querying (it's the top option in
the left column) to display the Connect to Database dialog.
4.
Make sure the hostname is correct, the user name should be
root
, and
you should enter the root password if one was specified at installation
time. Click OK and you should see the SQL Editor window. Existing
databases are listed in the Overview tab at the top of the lower half of
the screen.
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.
Click the + button on the right above the listed databases to display
the new_schema dialog (
schema
is another name for a database). Type
crashcourse
in the name field and click Apply. You are presented
with a confirmation dialog. Click Apply again to create the database.
When you receive confirmation click Finish and close the dialogs.