Installation Tutorial
Installation
This section covers the detailed steps for installing MySQL 8.4 on Windows, macOS, and Linux. Each subsection will offer a clear explanation, practical examples, and step-by-step instructions, along with post-installation setup.
Installing MySQL 8.4 on Windows
Step 1: Download MySQL Installer
-
Go to the MySQL Downloads page:
- Navigate to the MySQL official website at https://dev.mysql.com/downloads/installer/.
-
Select the MySQL Installer:
- Choose the
MySQL Installer for Windows
and download themysql-installer-web-community-8.4.x.msi
file.
- Choose the
Step 2: Run the Installer
-
Open the Installer:
- Double-click the downloaded
.msi
file to launch the installer.
- Double-click the downloaded
-
Setup Type:
- You will be prompted to select a setup type. Choose
Custom
to customize the components you need orDeveloper Default
for a comprehensive setup.
- You will be prompted to select a setup type. Choose
Step 3: Installation
-
Select Products and Features:
- Ensure that
MySQL Server
,MySQL Workbench
, and other desired components are selected.
- Ensure that
-
Check Requirements:
- The installer will check for any missing requirements. Install any necessary software, such as
Visual C++
, if prompted.
- The installer will check for any missing requirements. Install any necessary software, such as
-
Installation Progress:
- Click
Execute
to begin the installation of the selected components.
- Click
Step 4: Initial Configuration
-
Configuration Type:
- Choose the
Standalone MySQL Server / Classic MySQL Replication
option.
- Choose the
-
Server Configuration:
- Set the Config Type to
Development Computer
,Server Computer
, orDedicated Computer
, based on your needs. - Choose the
Connectivity
options such as default port3306
.
- Set the Config Type to
-
Authentication Method:
- Select
Use Strong Password Encryption
for enhanced security.
- Select
-
MySQL Root Password:
- Set a strong root password and add any additional MySQL users if necessary.
-
Windows Service:
- Ensure that
Configure MySQL Server as a Windows Service
is checked. Optionally, set the service to start automatically.
- Ensure that
Step 5: Complete Installation
-
Execute Configuration:
- Click
Execute
to apply the configuration settings.
- Click
-
Finish:
- Once the installation and configuration are complete, you will see a summary. Click
Finish
.
- Once the installation and configuration are complete, you will see a summary. Click
Installing MySQL 8.4 on macOS
Step 1: Download MySQL DMG Archive
-
Go to the MySQL Downloads page:
- Navigate to https://dev.mysql.com/downloads/mysql/.
-
Select macOS:
- Choose
macOS
and download thedmg
file for MySQL 8.4.
- Choose
Step 2: Install MySQL
-
Open DMG File:
- Double-click the downloaded
.dmg
file to mount it.
- Double-click the downloaded
-
Run the Installer:
- Double-click the
mysql-8.4.x-macos10.x-x86_64.pkg
file.
- Double-click the
-
Follow Installer Steps:
- Follow the onscreen instructions in the install wizard.
-
Authentication:
- During installation, you may be prompted to enter your macOS password to authorize the installation.
Step 3: Initial Configuration
-
MySQL Preference Pane:
- After installation, a
MySQL
preference pane will be added toSystem Preferences
.
- After installation, a
-
Start MySQL Server:
- Open
System Preferences
->MySQL
and clickStart MySQL Server
.
- Open
-
Set Up Root Password:
- During initial startup, you will be prompted to set the root password.
Step 4: Add MySQL to System Path (Optional)
-
Edit Profile:
- Open Terminal and edit your profile file (
~/.bash_profile
or~/.zshrc
, depending on your shell).
- Open Terminal and edit your profile file (
-
Add Path:
- Add the following line:
export PATH=/usr/local/mysql/bin:$PATH
- Add the following line:
-
Apply Changes:
- Source the profile by running:
source ~/.bash_profile
- Source the profile by running:
Installing MySQL 8.4 on Linux
Step 1: Update Package Repository
-
Open Terminal:
- Open your terminal window.
-
Update Package Lists:
- Run the following command to update your package lists:
sudo apt update
- Run the following command to update your package lists:
Step 2: Install MySQL
-
Add MySQL APT Repository:
- Download the MySQL APT repository package:
wget https://dev.mysql.com/get/mysql-apt-config_0.8.17-1_all.deb
- Install the MySQL APT config package:
sudo dpkg -i mysql-apt-config_0.8.17-1_all.deb
- Download the MySQL APT repository package:
-
Update Package Lists Again:
- Run:
sudo apt update
- Run:
-
Install MySQL Server:
- Install MySQL server:
sudo apt install mysql-server
- Install MySQL server:
Step 3: Secure MySQL Installation
-
Run Security Script:
- Execute the following command to run the security script:
sudo mysql_secure_installation
- Execute the following command to run the security script:
-
Follow Prompts:
- Follow the prompts to set the root password, remove anonymous users, disallow root login remotely, remove test databases, and reload privilege tables.
Step 4: Start MySQL Service
-
Start Service:
- Ensure the MySQL service is running:
sudo systemctl start mysql
- Ensure the MySQL service is running:
-
Enable Service to Start at Boot:
- Enable MySQL to start on boot:
sudo systemctl enable mysql
- Enable MySQL to start on boot:
Post-Installation Setup
Regardless of your operating system, after installing MySQL 8.4, you should perform the following post-installation setup:
Step 1: Verify Installation
-
Open Terminal or Command Prompt:
- Open your terminal (Linux/macOS) or Command Prompt (Windows).
-
Log in to MySQL:
- Log in to MySQL using the root user:
mysql -u root -p
- Log in to MySQL using the root user:
-
Check Version:
- Verify the MySQL version:
SELECT VERSION();
- Verify the MySQL version:
Step 2: Create a Database and User
-
Create Database:
- Create a new database:
CREATE DATABASE mydatabase;
- Create a new database:
-
Create User:
- Create a new user and grant privileges:
CREATE USER 'myuser'@'localhost' IDENTIFIED BY 'mypassword'; GRANT ALL PRIVILEGES ON mydatabase.* TO 'myuser'@'localhost'; FLUSH PRIVILEGES;
- Create a new user and grant privileges:
Step 3: Exit MySQL
- Exit:
- Exit the MySQL command line:
EXIT;
- Exit the MySQL command line:
By following these detailed steps, you will have MySQL 8.4 installed and set up on your Windows, macOS, or Linux system, ready for further configuration and use.