The MySQL server is available for a variety of platforms including most Linux and Unix platforms, Mac OS X, and Windows. As of this writing, MySQL 8 was not a GA release and as such only offered as a development milestone release (DMR). DMRs are an excellent way for you to try out new versions and features before they are released as GA. Generally, non-GA releases are considered developmental or in the case of early release candidates such as MySQL 8.0.4, a release candidate. Thus, you should not install and use DMR releases on your production machines.
43 To download GA releases of MySQL 8, visit http://dev.mysql.com/downloads/
and click Community, then MySQL Community. You can also click on the link near the bottom of the downloads page named Community (GPL) Downloads, then click MySQL Community Server. This is the GPLv2 license of MySQL. The page will automatically detect your operating system. If you want to download for another platform, you can select it from the dropdown list.
The download page will list several files for download. Depending on your platform, you may see several options including compressed files, source code, and installation packages. Most will choose the installation package for installation on a laptop or desktop computer. Figure 2-1 shows an example of the various download options for macOS platforms.
One of the most popular platforms is Microsoft Windows. Oracle has provided a special installation packaging for Windows named the Windows Installer. This package includes all the MySQL products available under the community license including MySQL Server, Workbench, Utilities, and all of the available connectors (program libraries for connecting to MySQL). This makes installing on Windows a one-stop, one- installation affair. Figure 2-2 shows the download page for the Windows installer.
Figure 2-1. Download page for macOS
CHaPTeR 2 GeTTING STaRTed wITH MySQL
However, you should note that some of the more advanced features and some of the plugins that also are in a developer milestone release (DMR) state may not be included in the Windows Installer. Thus, you should consider installing by using the server
package. We see these below the Windows Installer download link in Figure 2-2. You can choose either the Windows Installer 32- or 64-bit installation. Note that the package may be nothing more than a .zip file containing the server code. In this case, you may need to either run the server from the unzipped folder or do a local, manual install.
Fortunately, as MySQL 8 matures, more packaging options will become available allowing you to use a semi-automated installation mechanism. Let’s see one of those in action. In this scenario, we will install MySQL 8 on a macOS Sierra machine. In this case, I have downloaded the file mysql-8.0.11-macos10.13-x86_64.dmg, which is a compressed file containing a package installation program named mysql-8.0.11- macos10.13-x86_64.pkg for macOS. Once I launch the installer, the first step is agreeing to the license. Figure 2-3 shows the license agreement panel of the installation dialog.
Figure 2-2. Download page for Windows Installer
45 The license shown is the GPLv2 license for the community edition. You can read the license and when ready, click Continue. You will see an acceptance dialog open, which will give you another chance to read the license.1 When you’re ready to accept the license, click Accept. Figure 2-4 shows the license acceptance dialog.
1 You really should read the license at least once.
Figure 2-3. License agreement
Figure 2-4. Accept license
CHaPTeR 2 GeTTING STaRTed wITH MySQL
The next panel displays the setup or installation type. Early releases such as this version may not show any installation types to choose from. If you run the Windows Installer, you will see several options. For most platforms, the default installation type is all you will need to get started. Figure 2-5 shows the installation type panel. When ready, click Install.
The installation may ask you to authorize the installation and once done, it will proceed rather quickly installing MySQL in the /usr/local/mysql folder (e.g., on Sierra).
If this is the first time you’ve installed MySQL 8, you will see a dialog that displays the default password for the root account. This was a change made in MySQL 5.7, which eliminated anonymous accounts and made server installations more secure. You should take note of this password, as it is a general random collection of characters and symbols that you won’t be able to guess. Figure 2-6 shows one such example dialog.
Figure 2-5. Installation type
47 Figure 2-7 shows how you can recover this dialog on macOS from the notification center if you, like me, tend to dismiss dialogs without fully reading them.2
Once complete, you will get a completion dialog, which you can safely dismiss.
Finally, you will be asked whether you want to keep the installation file (the .dmg) or delete it. If you are experimenting with MySQL 8 or think you may want to install it some other place, do not delete the file.
Tip It may be a good idea to add the path /usr/local/mysql/bin to your default PaTH variable if it is not already set. It makes starting the MySQL client tools much easier.
2 Yes, I know. A shameful practice for which I must do penance. Admit it. You do it too, don’t you?
Figure 2-6. Root password notice
Figure 2-7. Root password notice in macOS notification center
CHaPTeR 2 GeTTING STaRTed wITH MySQL
As you may have surmised, you need to change the root password as your first action after installation. Doing so is easy. Just open the MySQL client (mysql) and issue the following SQL statement. Because we installed the server in the default location, we can start the client with only the user and password prompts like this: mysql -uroot -p. The client will prompt you for the password.
SET PASSWORD='NEW_PASSWORD_GOES_HERE';
If you get a message that you cannot connect to the server, it may mean the server has not been started. You can start the server on macOS with the following command.
sudo launchctl load -F /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.
plist