How to setup MySQL Database on Windows
Step 1: Download MySQL Database from: MySQL Website. I have downloaded mysql-5.7.19-winx64.zip and will be using it in this post.
Step 2: Create a new folder named data in the MySQL directory (in the same location as where bin directory is located). For me it is: D:\Programs\mysql-5.7.19-winx64. This location will vary as per the location where you have extracted the MySQL zip file.
So once the data folder is created, its location for me is: D:\Programs\mysql-5.7.19-winx64\data
So once the data folder is created, its location for me is: D:\Programs\mysql-5.7.19-winx64\data
Step 3: From here, I am using my MySQL folder location as reference. Go to: D:\Programs\mysql-5.7.19-winx64\bin, depending on whether you want the server to generate a random initial password for the 'root'@'localhost' account, execute the command:
mysqld --initialize-insecureor
mysqld --initialize
Step 4: To start the MySQL Database, go to: D:\Programs\mysql-5.7.19-winx64\bin and execute:
mysqld --console
You can see the start-up logs being printed.
Step 5: To connect to the MySQL Database, go to: D:\Programs\mysql-5.7.19-winx64\bin and execute:
mysql -u root -p
When prompted, enter password if it has been set or else just hit "Enter" button to connect.
In my MySQL Database, I have created a database named: softwaredevelopercentral. Hence once I connect, here are a few useful queries that I use:
> show databases; > use softwaredevelopercentral; > show tables;
Comments
Post a Comment