0% found this document useful (0 votes)
22 views9 pages

Appendix B

This appendix provides instructions for setting up macOS with MySQL Community Server and MySQL Workbench for use with the book. It includes details on installing the software, downloading necessary files, creating databases, and restoring them if needed. The document emphasizes using MySQL version 8.0 for compatibility with the book's content and provides step-by-step procedures for installation and database management.

Uploaded by

kitso
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views9 pages

Appendix B

This appendix provides instructions for setting up macOS with MySQL Community Server and MySQL Workbench for use with the book. It includes details on installing the software, downloading necessary files, creating databases, and restoring them if needed. The document emphasizes using MySQL version 8.0 for compatibility with the book's content and provides step-by-step procedures for installation and database management.

Uploaded by

kitso
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Appendix B

How to set up macOS


for this book
Before you begin reading this book, we recommend that you install MySQL
Community Server and MySQL Workbench. Both of these software products
are available for free from the MySQL website, and you can install them on
your computer as described in this appendix.
After you install these products, we recommend that you download
the files for this book that are available from the Murach website
(www.murach.com). Then, we recommend that you run the SQL script that
creates the databases that are used throughout this book.
Once you create these databases, you’re ready to gain valuable hands-on
experience by running the SQL scripts for the examples presented in this
book. In addition, you can get more practice by doing the exercises that are at
the end of each chapter, starting with chapter 2.

How to install MySQL Community Server................................................. 602


How to start and stop the MySQL sever...................................................... 602
How to install MySQL Workbench............................................................. 604
How to download the files for this book...................................................... 606
How to create the databases for this book................................................... 608
How to restore the databases....................................................................... 608
602 Appendix B How to set up macOS for this book

How to install MySQL Community Server


MySQL Community Server is a database server that’s free and easy to use.
Since it’s designed to run on most modern computers, it’s ideal for developers
who want to install it on their computer so they can learn how to work with a
MySQL database. That’s why this book assumes that you have installed the
Community Server on your computer.
In July 2023, Oracle announced a new versioning model for MySQL that
provides two different release tracks. The releases that contain new features and
improvements will be known as Innovation versions, and the releases that will
only be updated with bug fixes after the initial release will be known as Long
Term Support (LTS) versions. Oracle also released the first Innovation version,
MySQL 8.1 Innovation. In addition, Oracle announced that MySQL 8.0.34 and
later will only be updated with bug fixes, not with new features or improve-
ments. As a result, MySQL 8.0 is now essentially an LTS version.
So, which version should you install? If you want to make sure the MySQL
server works exactly as described in this book, we recommend installing
MySQL 8.0. That’s because all of the SQL statements presented in this book
have been tested against MySQL 8.0.
On the other hand, if you want the latest features and improvements as
they become available, you should install the newest Innovation version of
MySQL. Or, if you only want access to the features included in an LTS version,
you should install the newest LTS version. Oracle plans to release the first LTS
version in 2024. Since MySQL is backwards compatible, the SQL statements
presented in this book should also work with these releases of MySQL. For
example, we tested all of the SQL statements in this book against MySQL 8.1,
and they all worked correctly.
Once you decide on a version of the MySQL server, you can install it
as described in figure B-1. As part of this procedure, you need to specify a
password for the root user. When you do, make sure to remember the password
that you enter.

How to start and stop the MySQL sever


To make sure the MySQL server has been installed correctly, you can
start the MySQL preference pane and check whether the MySQL server is
running. By default, the MySQL server starts automatically when you start your
computer. However, there are times when you may want to stop this server. For
example, you can stop this server if you aren’t going to be using it and you want
to free the resources on your computer. To do that, you can use the procedure
shown in figure B-1. Then, when you’re ready to start the server again, you can
use this procedure to do that too.
Appendix B How to set up macOS for this book 603

The MySQL Community Server downloads page


http://dev.mysql.com/downloads/mysql/

How to install MySQL Community Server


1. Go to the MySQL Community Server downloads page. If necessary, you can find
this page by searching the internet for “MySQL community server download”.
2. Select the version of the MySQL server, select macOS as the operating system, and
select the operating system version for your processor (x86 or ARM).
3. Download the disk image (DMG) file by clicking on its Download button.
4. Find the downloaded DMG file and double-click it. This opens a window with a
package (PKG) file.
5. Double-click the PKG file for MySQL, and respond to the resulting dialog boxes to
install it. You can accept most of the default options and specify a password for the
root user. Make sure to remember the password that you enter.

How to start and stop the MySQL server


1. Use the Apple menu to select System Preferences.
2. Click the MySQL icon.
3. Use the buttons on the MySQL preference pane to start or stop the MySQL server.
Or, use the check box on that page to control whether the MySQL server starts
automatically when you start your computer.

Description
•• In July 2023, Oracle announced a new versioning model for MySQL that provides
two different release tracks. The releases that contain new features and improve-
ments will be known as Innovation versions, and the releases that will only be
updated with bug fixes after the initial release will be known as Long Term Support
(LTS) versions.
•• Since July 2023, Oracle is only updating MySQL 8.0 with bug fixes, not new
features or improvements. As a result, MySQL 8.0 is now essentially an LTS
version.
•• If you want to make sure that the MySQL server works exactly as described in this
book, you should use the 8.0 version.
•• If you want access to the latest features as they become available, you should use
an Innovation version. The first Innovation version is 8.1.
•• If you only want access to the features included in an LTS version, you can use that
version. The first LTS version will become available in 2024.
•• You can use the MySQL preference pane to start and stop the MySQL server and
to control whether the MySQL server starts automatically when you start your
computer.

Figure B-1 How to install MySQL Community Server


604 Appendix B How to set up macOS for this book

How to install MySQL Workbench


MySQL Workbench is a free program that makes it easy to work with
MySQL databases. To install MySQL Workbench, you can use the procedure
shown in figure B-2.
If you install a newer version of MySQL server such as 8.1 Innovation,
you may still need to install an older version of Workbench such as 8.0. That’s
because there may not yet be a newer version of Workbench that corresponds to
your version of the MySQL server. In that case, you can install the older version
of Workbench and use it until a new version becomes available.
All of the skills for working with MySQL Workbench presented in this
book were tested against version 8.0. As a result, if you’re using this version of
MySQL Workbench, these skills should work exactly as described. If you’re
using a later version of MySQL Workbench, these skills may not work exactly as
described, but they should work similarly.
Appendix B How to set up macOS for this book 605

The MySQL Workbench downloads page


http://dev.mysql.com/downloads/workbench/

How to install MySQL Workbench


1. Go to the MySQL Workbench downloads page. If necessary, you can find this page
by searching the internet for “MySQL Workbench community download”.
2. Select macOS as the operating system.
3. Click the Download button to download the disk image (DMG) file for the latest
version of MySQL Workbench that matches your processor (x86 or ARM).
4. Find the DMG file on your hard disk and double-click on it.
5. Respond to the resulting dialog boxes.

Notes
•• If you install a newer version of MySQL server such as 8.1 Innovation, you may
need to install an older version of Workbench such as 8.0. That’s because there may
not yet be a newer version of Workbench available.
•• To make it easy to start MySQL Workbench, you may want to keep this application
in your dock.

Figure B-2 How to install MySQL Workbench


606 Appendix B How to set up macOS for this book

How to download the files for this book


Figure B-3 shows how to download the files for this book. This download
includes a SQL script that you can use to create the databases that are used
throughout this book. It includes SQL scripts for all of the examples in this
book. And it includes SQL scripts for the solutions to the exercises that are at the
end of each chapter.
The files for this book are in a zip file that you can download from
www.murach.com. When you download this file, it contains a directory named
mysql that stores the SQL script files for this book. Within this directory, you
can find the subdirectories that contain the files shown in this figure.
After double-clicking on the zip file to unzip the mysql directory, we recom-
mend moving this directory into a directory named murach that you can create
in your Documents directory. That way, your system will store the files for this
book in the directory shown at the top of this figure.
In this book, there are two figures (17-10 and 19-4) that show how to use the
command line to work with files. To keep the path to the files short, these figures
use a path of
/murach/mysql
However, to get these figures to work correctly on macOS, you need to substitute
the following path:
/Users/yourname/Documents/murach/mysql
Here, you need to substitute your macOS username for yourname. For example,
for a username of johndoe, you could use this path:
/Users/johndoe/Documents/murach/mysql
Appendix B How to set up macOS for this book 607

The recommended directory for the files


Documents/murach/mysql

The files for this book


Directory Contains
db_setup The SQL script that creates the three databases for this book.
book_scripts The SQL scripts for all of the examples presented in this book.
ex_solutions The SQL scripts for the solutions to the exercises at the end of each chapter.
diagrams The MySQL Workbench file for the diagram that’s presented in chapter 10.

The databases for this book


Database Description
ap The AP (Accounts Payable) database. This database is used by most
examples in this book.
om The OM (Order Management) database. This database is used by a few
examples in this book.
ex The EX (Examples) database. This database contains several tables that are
used for short examples.

How to download the files


1. Go to www.murach.com.
2. Find the page for Murach’s MySQL (4th Edition).
3. Scroll down to the “FREE downloads” tab and click it.
4. Click the Download Now button for the zip file to download a setup file named
msq4_allfiles.zip.
5. Find the downloaded zip file and double-click on it to unzip it. This creates the
mysql directory and its subdirectories.
6. If necessary, use the Finder to create the murach directory in the Documents
directory.
7. Use the Finder to move the mysql directory into the murach directory.

Description
•• All of the source files described in this book are in a zip file that can be
downloaded from www.murach.com.

A note about right-clicking


•• This book often instructs you to right-click, because that’s common in Windows.
On macOS, right-clicking is not enabled by default. Instead, you can use Ctrl-click
instead of right-click. Or, if you prefer, you can enable right-clicking by editing the
system preferences for your mouse.

Figure B-3 How to download the files for this book


608 Appendix B How to set up macOS for this book

How to create the databases for this book


Before you can run the SQL statements presented in this book, you need to
create the three databases used by this book. To do that, you can use MySQL
Workbench to run the SQL script that’s stored in the create_databases.sql file as
described in figure B-4.
To determine if the SQL script ran successfully, you can review the results
in the Output window. In this figure, for example, the Output window shows a
series of statements that have executed successfully. In addition, the Schemas tab
of the Navigator window shows that the three databases have been created. The
other database, named sys, is a database that comes with MySQL.
If the script encounters problems, MySQL Workbench displays one or more
errors in the Output window. Then, you can read these errors to figure out why
the script isn’t executing correctly.
Before you can run the create_databases.sql script, the database server must
be running. By default, the database server starts automatically when you start
your computer, so this usually isn’t a problem. However, if it isn’t running on
your system, you can start it as described in figure B-1.

How to restore the databases


As you work with the code that’s presented in this book, you may make
changes to the databases that you don’t intend to make. In that case, you may
want to restore the databases to their original state so your results match the
results shown in this book. To do that, you can run the create_databases.sql file
again. This deletes the three databases described in this appendix and recreates
them.
Appendix B How to set up macOS for this book 609

The directory that contains the create_databases.sql file


Documents/murach/mysql/db_setup

MySQL Workbench after executing the create_databases.sql file

Execute Script
button

Open SQL Script


File button

How to create the databases


1. Start MySQL Workbench.
2. Click on the stored connection named “Local instance MySQL” and enter the
password for the root user if prompted. This is the password that you created when
installing the MySQL server in figure B-1. This connects you as the root user to the
local instance of MySQL.
3. If Workbench doesn’t display a connection, you can create one. To do that, click the
icon to the right of MySQL Connections, enter “Local instance MySQL” for the
connection name, and click the OK button.
4. If you get a warning that MySQL Workbench is incompatible with the server
version and that some features may not work properly, don’t be alarmed. You can
click Continue Anyway and the features described in this book should still work.
5. Open the create_databases.sql file by clicking the Open SQL Script File button.
Then, use the resulting dialog box to locate and open the file. When you do,
MySQL Workbench displays this script in a SQL Editor tab.
6. Execute the script by clicking the Execute Script button. When you do, the Output
window displays messages that indicate whether the script executed successfully.

How to restore the databases


•• Run the create_databases.sql script again to drop the databases and recreate them.
Figure B-4 How to create and restore the databases for this book

You might also like