Using MariaDB in CSI 3335
There instructions are for 64-bit Windows systems. For MacOS users, this page contains instructions, but I have not verified it.
If you are downloading to your machine, follow the instructions here. You must have admin access to install the software. Note that these instructions are for mariadb, but the executable is called mysql.
- Download MySQL and unzip the files into a directory.
When you unzip the files, this creates the
top-level MySQL directory (e.g., C:\mysql-12.3.3). For the rest of these instructions, these directions assume this directory is called MYSQL.
- Create the directory MYSQL\data.
- Download and unzip the database initialization files into the MYSQL directory.
There should be 5 files -- SQL.bat, SQLInit.bat, SQLStartup.sql, SQLStart.bat and SQLstop.bat.
- Execute SQLInit.bat. If there are any problems with this file, you will need to empty MYSQL\data. This may take a few minutes to run. AFTER THE FIRST TIME YOU START MARIADB, DO NOT RUN THIS FILE AGAIN!
- Execute SQLStart.bat You should see a console window. Server error messages will appear here. You will need to execute this file everytime you start mariadb.
- Execute SQL.bat. You should see another console window, with a prompt asking for a password. Right now, there is no password, so just hit enter. You
should see a mysql prompt. You will need to execute this file everytime you want to access the SQL console.
Database loading instructions
Now you are ready to execute SQL statements! The first time you start mariadb, you need to setup the database.
At the mysql prompt, the command \. filename (slash period space)
will read a file
and execute the SQL commands.
Type
\. SQLSetup.sql
at the mysql prompt to set the root password (CSI3335) and create the baseball database.
Next, you need to tell mariadb to use the baseball database via the command
use baseball;
You are now ready to load the data from the online LampQuest game!
Download the file
baseball.sql
and place it in MYSQL. Use the read file command (\. baseball.sql) to load the schema and the initial data.
Your database is ready for Assignment 1!
In the future, you will only need to start the database by executing SQLStart.bat and SQL.bat (int that order). Connect to the baseball database, and you are good to go!
When you are finished, exit the command console with the command
quit
Terminate MySQL by executing the SQLstop.bat program.
You will be prompted for the root
password before the DBMS quits. Feel free to play around with killing
the database in unexpected ways.