CopyDisable

Showing posts with label Windows. Show all posts
Showing posts with label Windows. Show all posts

Monday, 13 May 2024

MySQL 8 silent installation on Windows 11

In this post I am going to show you how to install MySQL 8.* version on a windows 11 machine. For this post I am going to use MySQL 8.4 version.

Open windows Command Prompt with administrative privileges. 

Step 1: To install MySQL 8.4 version, we need to have visual studio 2019 x64 redistributable installed in our Windows 11 machine. So first we will install this prerequisite: 

Download visual studio 2019 x64 redistributable from the URL:

https://download.visualstudio.microsoft.com/download/pr/c7707d68-d6ce-4479-973e-e2a3dc4341fe/1AD7988C17663CC742B01BEF1A6DF2ED1741173009579AD50A94434E54F56073/VC_redist.x64.exe

Install visual studio 2019 x64 redistributable silently from the command prompt:

VC_redist.x64.exe /q /norestart


Step 2: Create MySQL data directory, in this directory MySQL database going to reside:

mkdir C:\ProgramData\MySQL\Data


Step 3: Create a directory to store MySQL config file:

mkdir C:\ProgramData\MySQL\Config


Step 4: Create mysql.ini config file inside C:\ProgramData\MySQL\Config folder:


[client]

port=3306

[mysql]

no-beep

[mysqld]

port=3306

datadir=C:/ProgramData/MySQL/Data

default-storage-engine=INNODB

lower_case_table_names=1


Step 5: Install MySQL silently 

mysql-8.4.0-winx64.msi /qn INSTALLDIR="C:\Program Files\MySQL"


Step 6: Create MySQL Windows Service:

"C:\Program Files\MySQL\bin\mysqld" --install MySQL --defaults-file=C:\ProgramData\MySQL\Config\mysql.ini


Step 7: Initialize MYSQL

"C:\Program Files\MySQL\bin\mysqld" --defaults-file=C:\ProgramData\MySQL\Config\mysql.ini  --initialize-insecure


Step 8: Add MySQL Path to environment variable:

setx /M PATH "%PATH%;C:\Program Files\MySQL\bin"


Step 9: Start MySQL service:

net start MySQL


We can add the above commands in a script and run that script as admin user to make this installation completely silent. 

Wednesday, 23 November 2011

Using head command in Windows

Recently I had to read first few lines of a very large sql dump file (of size 15GB) in one Windows server. It’s quite easy in a Linux box, but I was in mess how to do it in the Windows system. After some searching I found CoreUtils. It’s a collection of some small handy utilities for basic file, shell and text manipulation and these utilities mainly exist in GNU operating system. You can download CoreUtils for Windows from  http://gnuwin32.sourceforge.net/packages/coreutils.htm. I have downloaded the zip archive coreutils-5.3.0-bin.zip in my Windows 2003 server machine and extracted in D:\coreutils-5.3.0-bin . Now lets see if I can run the head command
image

Oops some error, I need to download the dependency files also.
image

Now I have downloaded the dependency archive file coreutils-5.3.0-dep.zip. Extract the archive and copy the libiconv2.dll and libintl3.dll files into the coreutils bin folder. Now lets try again
image

Yeeppiiiii….. this time it worked. Now I can run the head command in Windows also. This is very helpful in reading large log files in Windows server using the very useful command like head (in Windows using more command we may alternate the head command). But I am always comfortable with head command and it was a big relief for me :) .

Tuesday, 23 August 2011

Script to delete files of n days old.... Windows server


Synopsis:

In one of the windows servers, I am storing backup files of a database server. As per our policy we have to keep backup files for 30 days. As in the partition size where I am storing backup files is small, so I have to regularly delete backup files to manage free space in that partition. I could easily write a shell script in Linux to delete 30 days old file, but I was not sure how to do it in the Windows 2003 server. Then I came to know about Forfiles (http://technet.microsoft.com/en-us/library/cc753551%28WS.10%29.aspx ) , I used it and wrote a batch script which will delete 30 days old file everyday.


The script is as follows:

@echo off & setlocal

Create a variable to store the name of the temporary file to capture the output. If you do not want to capture the file names that are deleted, you can skip the temporary file part.

set tempmail=%temp%\solardb_delete.txt

Just writing a blank line to the temporary file
echo.>>%tempmail%

-p option of forfile specifies the path where it will look for files, -d -30 specifies to select files last modified 30 days before current date (its minus 30). –c specifies the command to execute. The command first appends the filename to be deleted into the temporary file and then deletes the file.

forfiles -p F:\MySQLBackup\Today -d -30 -c “cmd /c echo deleting @FILE .>>%tempmail% & del @FILE”

Next part of this script is to send the mail alert, also sending the temporary file containing the deleted file names as an attachment in the mail. For this I used a php script (the reason of using php script is that, I can use external SMTP server of rediff to send the mail and do not have dependency on local SMTP sever. Otherwise this can also be done through a batch script), you can use any script/program as you like to the send mail alert. Otherwise you can skip the following part.

move %tempmail% F:\php_script\output

set tempmail=

endlocal

php F:\php_script\mysql_backup_delete.php

del /Q F:\php_script\output\solardb_delete.txt


জয় আই অসম,
প্রণব শর্মা

Monday, 15 August 2011

Changing remote computer’s IP configuration from command line

1) I used PsExec tool to run command in a remote computer. It can be downloaded from http://download.sysinternals.com/Files/PsTools.zip
PsExec tool execute a process on a remote computer.
Syntax: psexec \\computer[,computer[,..] [options] command [arguments]


2) Now the command I will use to change the IP configuration is netsh.
netsh is a command-line tool for updating Windows network configuration settings. It also has options for configuring remote systems but in this example I am not going to use that.
We can also use netsh to find the IP configuration information.


3) We can even use it to enable or disable windows firewall.
For Windows XP use the following:
 For Windows Vista and above:


4) To change a computer’s network adapter to use static IP address:
I have configured vaibhav’s adapter with the static IP 172.16.0.44 netmask 255.255.255.0 and default gateway 172.16.0.3.



5) To change a computer’s network adapter to use dynamic IP address from DHCP server:




netsh command is wonderful and it has many options. Explore it to enjoy its full functionality.


জয় আই অসম,
প্রণব শর্মা

Sunday, 14 August 2011

Small Trick to open the windows command prompt

Scenario: We had a problem in one of our servers. We were not able to run any executable file from windows run, from the task manager New task (run…), using the shortcut on the desktop, or from the Start menu. The registry entries for the executable files were damaged. We were not able to run the registry editor, windows explorer, command prompt etc. We could not run any tool, antivirus etc. I used one trick to open the command prompt, using the command prompt I was able to install and run a web-browser, after that I could download and install antivirus etc. and run them from command prompt.
It is very very simple and I think it may be useful for us in future.
The trick:
Right Click on any file like text file, image file etc. and select open with command processor












So here is my command prompt 1,  and I can do my stuffs now 36.


জয় আই অসম,
প্রণব শর্মা

Thursday, 11 August 2011

Shutting a computer remotely using Microsoft Management Console (MMC)

1) Open computer management console (Right-click the My Computer desktop icon and select Manage), then right-click Computer Management(Local) and select Connect to another computer. Enter/select the remote system you want to restart. Click OK



2)After getting connected to the remote computer, right-click Computer Management and select Properties



3) In the Computer Management properties window, go to the Advanced tab.  



4) Click the Settings button in Startup and recovery. 



5) Click on Shut Down button. The Shut Down window has different shutdown options. Select the option as per requirement and click OK. 



জয় আই অসম,
প্রণব শর্মা