Recently I had faced an issue where user had already installed MariaDB/mySQL but didn’t write down the password. Issue with this is even if you remove package and install it again my_secure_installation command asks for the root password which was set in initial installation. RHEL has already replaced mysql with mariaDB to handle databases as default package.

To overcome this issue there might be several ways however distro on which I was working RHEL 7.3 following method help solve it.

grep 'temporary password' /var/log/mysqld.log

 
it return a temp password through which I was able to login to DB engine by username : root and after that changed it so that old password is no longer working.

NOTE: This has not been tested on Centos 7 or equivalent distro. HOPE IT HELPS !!!

About RHEL 7.3 :
Red Hat Enterprise linux is developed and designed by Red Hat and is targeted for corporate/commercial environment for critical application which requires stable OS as compared to community driven distros such as the fedora project and CentOS. Red Hat uses trademark rules to restrict free re-distribution of their officially supported versions of Red Hat Enterprise Linux, but still freely provides its source code. Third-party derivatives can be built and redistributed by removing non-free components. Examples include community-supported distributions like CentOS and Scientific Linux, and commercial forks like Oracle Linux, which does not offer 100% binary compatibility with Red Hat Enterprise Linux

About MariaDB :
MariaDB is a community-developed under GNU GPL license and contributors are required o share their copyright with MariaDB foundaion. It is fork of the MySQL database management system, Development is led by some of the original developers of MySQL. MariaDB intends to maintain high compatibility with MySQL, ensuring capability with library binary equivalency and exact matching with MySQL APIs and commands.

Sources: http://stackoverflow.com/questions/33510184/change-mysql-root-password-on-centos7

Leave a Reply

Your email address will not be published. Required fields are marked *