A Complete Step-by-Step Guide to Installing MySQL on Windows
Introduction: Selecting the Products
MySQL Server, Workbench, and Shell are required. So all these three are required to install MySQL on the Windows operating system. Click Next. Ready to install. Now, click Execute. Now, MySQL Server, Workbench, and shell will get installed. Let's wait.
|
|
| step 1 |
|
|
| products |
Step 1: Product Configuration
The status is complete. Now click Next. Product Configuration. Click Next. The Type and Networking section is visible. Keep it as it is and click Next.
The Authentication method is visible. It is recommending us to use a strong password. So keep it as it is and click next.
Step 2: Setting the Root Password
Add a password. You need to add your own password here. So let's add. This will set a password for our user. So you would be wondering what a user is here. The user is root. So here the user is root, and the password is the following. You need to add your own password here. Click Next.
Step 3: Finalizing the Installation
Windows service. Keep it as it is and click Next. Server file permissions. This is the location where your databases will be saved. Keep the default, which is, "Yes, grant full access." And click next.
Apply the configuration. Now I'll click Execute. Now, one by one, all of these configurations will get set, and our installation will complete. The configuration is successful. Click finish. Product configuration. Click Next. Installation complete. After the installation, this will start MySQL Workbench and the shell. Click Finish.
Step 4: Setting the Environment Variable (The Path)
So this is your shell and workbench. But the installation is not yet complete. We need to set the path. So let us go to the place where we installed MySQL.
It was in the C drive program files. Here, go to MySQL. Click on it. Click on MySQL Server. Click bin and copy this path. So this path we need to set so that we don't need to reach this path again and again.
[Suggestion: Add an image of the File Explorer showing the 'bin' folder path]
Go to start type environment variables. Here, click, Edit the system environment variables. Therefore, we will click open. Under the advanced, click environment variables.
Now, under system variables, double-click click path. Here, click New and set the path. Right-click and paste the same path. So this is our bin path. We have added the path. Now click okay. Okay. And the last, okay.
Step 5: Testing MySQL via Command Line
We have installed MySQL. Go to start. Type cmd. So this is how you need to start your MySQL for the first time. Click open.
Here type:
mysql -u -p
-
uis for user. So the user was root. I told you before. I have mentioned this before as well. -
After that, mention
-pthat is for password.
When I'll press enter. It will ask for the password. Enter the same password that we added before and press Enter. So we have installed MySQL.
Now, let us create a new database quickly. First, I'll use the
show databases
command to list the default databases. Here are the default databases.
Now, let us create a new database using the
create database
command. Here, add any name to your database. Let's say my database name is
amitdb. So I'll press
enter. Here, one row affected means we successfully executed this query.
Now, when I'll type the following command, that is,
show databases, it
will show five databases, which will include
amitdb also. So let us
type. When I'll press enter, it will show five databases. Here it is, amitdb
is visible. So we have created a default database.
Step 6: Using MySQL Workbench
Now, let us go to the workbench, which we already opened. So this is a UI to work on MySQL. I'll click here. Enter the same password that we added before. Click Save Password and click okay.
Now MySQL Workbench will open. Through this, you can easily create databases and tables.
