MySQL database getting connected with any username and password
As per suggested by Mr. Barmar it was causing due to --skip-grant-tables in MySQL.

To disable this option just run FLUSH PRIVILEGES; command in your MySQL CLI and this will solve the issue.