Sunday, April 18, 2021

How to get MySQL Shell in Ubuntu/Linux

 Often, we install MySQL Server in Ubuntu or Linux machines and then we tend to forget how to login to MySQL shell.

This may happen if we rarely login to MySQL Server since now a days most of the database table field additions and modifications can be handled by the Web app backend itself. 

If you wanna show MySQL command line in Ubuntu or Linux, use the following command:


mysql -u <username> -p


Here -u stands for username and -p stands for password 

You are required to replace <username> with your actual username for mysql. If you are trying to login as ROOT user. then you can use the command in the following way:


mysql -u root -p


Next you will be prompted with the password for root user. Once you enter the password. MySQL shell will appear where you can enter the MySQL query commands as usual.

Monday, April 5, 2021

How to unzip a file in Ubuntu or Linux

To unzip a file to usual folder in Ubuntu or Linux. Use the following commands:

Install Unzip (if not yet installed already)

To install unzip into your machine, use the following command:

sudo apt install unzip


After you have installed Unzip, follow these steps to unzip the file:

1. To unzip and extract the files inside the same folder

unzip filename.zip


2. To unzip and extract the files inside another folder


unzip filename.zip -d /home/pathtofolder/NewFolderName 


Bookmark this page if you keep forgetting! Hope it helps. Keep sharing

Tuesday, June 16, 2020

URL Redirection scenarios to be tested while installing SSL Certificates

If you are trying to install SSL certificates for the first time.

Do ensure to test all possible scenarios of URL direction


  • Ensure http URLs are redirecting properly
  • Ensure https URLs are not giving any invalid certificate errors
  • Ensure naked domains in http are redirecting properly
  • Ensure naked domains in https are redirecting properly

For Example, If you own the domain name as "yourdomain.com", then you must test all below scenarios by typing the below URLs in browser and testing all the page loads or redirection:


  • https://www.yourdomain.com
  • http://www.yourdomain.com
  • www.yourdomain.com

  • https://yourdomain.com
  • http://yourdomain.com
  • yourdomain.com

  • https://subdomain.yourdomain.com
  • http://subdomain.yourdomain.com
  • subdomain.yourdomain.com




Tuesday, April 28, 2020

How to install MySQL/MariaDb server in GCP Ubuntu Instance

f you are using Google Cloud Platform and trying to install MySQL server (MariaDB) on Ubuntu 16.04, you may frequently get some issues while trying to install.

You may get some error like the below one:

Errors were encountered while processing: mysql-server-5.7 mysql-serverE: Sub-process /usr/bin/dpkg returned an error code (1)

In this case, follow these steps to clean up the MySQL server installation.

Type the below command in the same order:

  • sudo mv /etc/mysql/my.cnf /etc/mysql/my.cnf.bak
  • sudo rm -r /etc/mysql/mysql.conf.d/
  • sudo mv /etc/mysql/debian.cnf /etc/mysql/debian.cnf.bak
  • sudo apt purge mysql-server mysql-server-5.7 mysql-server-core-5.7
  • sudo apt install mysql-server
  • sudo ln -s /etc/mysql/mysql.conf.d /etc/mysql/conf.d
  • sudo service mysql start


To check if MySQL is running properly or not, you can type below command to check status:

systemctl status mysql.service

or can use this command to know the version of MySQL

mysqladmin -p -u root version

Hope you found this post useful and it solved your problem!

I found this solution here: [Credits]

Thursday, March 26, 2020

Important Linux Commands - Ready Reckoner

Hi All,

In this blog, let me share some commonly used Linux commands which you may find useful in case you do not frequently interact with Linux servers or operating systems.


  • cd /<folder path> - Go inside a particular folder.
  • mkdir <folder name> - Create a new folder or directory with the given name.
  • ls - List the contents of the present directory.
  • rmdir <folder name> - Delete the directory or folder if it is empty.
  • exit - Leave the existing ssh session
  • sudo su - Switch to Super user.

I will keep adding the list based on the frequency of usage. Thanks for reading.

Tuesday, October 15, 2019

Unable to install MySQL server on Windows 10 - FIXED

Recently I was facing a weird error while trying to install MySQL Community server on a Windows 10 system.

Every time I start the MySQL Community installer and select MySQL server and try to install, It used to successfully download the setup file from internet but at the end it used to fail.

Usually progress percent used to go from 0 to 100% then again used to restart from 0% and used to go till 50% and then it used to show the error message as installation failed.

I googled out a lot and found many places which suggested to install both Microsoft Visual c++ redistributable for both x86 and x64. My system was a 64 bit system, I installed both the visuall c++ distribution but none of them worked even after rebooting system after every install.

What finally worked was this:

1. I wantedly started MySQL installer web and tried installing MySQL server  (version 8.0, earlier had tried 5.7 also).

2. Wantedly waited for the installation to fail.

4. Went to the folder C:\ProgramData\MySQL Installer for Windows\Product Cache. (ProgramData folder might be hidden, enable visibility of hidden file)

5. Selected the .exe file with name mysql-8.0.17-win64.exe and tried installing it again by double clicking that file.

6. But during this time at the time of selection, I selected custom install and excluded the "Server Data Files" while the dialog box was showing which all modules to install.

7. This time it installed well.

8. Once the installation completed. I went back to MySQL installer. Now MySQL server 8.0.17 was showing up. I clicked on reconfigure and went ahead with initial configuration and password setup of the MySQL server.

Hope this helps you save your infinite search to find solution to this known MySQL bug..

I am thankful to Peter (https://bugs.mysql.com/bug.php?id=89066) who posted this solution which I found after two days of rigorous search.

Sunday, April 21, 2019

How to remove last commit from Git

Sometimes while committing codes to Git, we end up doing wrong commits and hence would like to reverse the commit.

Here are the 3 commands which would be handy:

These commands are applicable when you are doing reverse commits in non-master branch:
Open Git Bash and type the following command:

1. git reset HEAD^               

This will remove the recent last commit from the active branch.


2. git push origin :branch_name 
This command would delete the branch from remote location of the git.


3. git push origin branch_name  

Now this command will push all the commits from your local to remove by creating the deleted branch again but without the last commit since you deleted it in local git.


If you want to reverse the commit in Master branch, it is little different, Here in non-master branch we deleted the whole branch in remote, but since Master branch is default branch and cannot be deleted, so the trick is little different. If you want to reverse your commit in Master branch, you can 
refer the below reference link from Stackoverflow: 


How to get MySQL Shell in Ubuntu/Linux

 Often, we install MySQL Server in Ubuntu or Linux machines and then we tend to forget how to login to MySQL shell. This may happen if we ra...