Thursday, March 14, 2019

Installing & Setup MySQL Database Community Server from ZIP

1. Dowload MySQL version from https://dev.mysql.com/downloads/mysql/

2. There is a folder inside the zip file, like this: mysql-5.6.43-winx64.zip,  Unzipped it to a directory. You may rename this folder as you like

3. To running up mysql, go to the mysql-5.6.43-winx64\bin folder, find file mysqld.exe, right click, choose Run As Administrator

Figure 1.

if you see command window like bellow, the mysql database already running and can be accessed with default port 3306

Figure 2.

To check mysql running status, use windows task manager in Process tab

Figure 3.

we can access mysql for the first time, by using windows's command prompt or sql tools like heidiSQL mysql workbench or other tools, with server address : localhost, username: root with blank password.

4. now we would like to change mysql root password using command prompt:
      - open command prompt

      - go to mysql directory then go to sub directory bin (d:\mysql-5.6.43-winx64\bin)

      - type : mysql -u root -p  ENTER

      - leave password field blank, ENTER

      - in command prompt just type like the bold font: 
            mysql> use mysql;  ENTER
            mysql> update users set password= PASSWORD('YOUR NEW PASSWORD') where username= 'root'; ENTER
            mysql> flush privileges; ENTER
            mysql> quit;

      - At this point, the root password has changed. You can check by login again from command prompt, type again: mysql -u root -p and fill the password with YOUR NEW PASSWORD above.

5. Close command prompt windows (Figure 2.) and check status process in (Figure 3.). If mysqld.exe disappears from Process tab (Figure 2.), it indicate that mysql was stopped. To register mysql service into windows service, go to point 4, and quit from mysql, and then type :
    
      d:\mysql-5.6.43-winx64\bin>mysqld --install  ENTER

Check the mysql service from windows task manager, go to Services tab, at the bottom window, click Open Services, find MySQL in the list, and check the status, if blank, just click button Start Service from toolbar, or right click, choose Start.

6. if you want to delete mysql service that already registered (point 5 above), just type 

     d:\mysql-5.6.43-winx64\bin>mysqld --remove  ENTER


Reff: MySQL documentation