Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Access Denied fro user 'root@localhost' on centos 7

Tags:

mysql

centos7

I am a newbie to CentOS .

I want to setup Mysqlfabric with multiple mysql servers in a single machine.

First i want to setup the Mysql instances. The following steps followed but i could not start the single mysql server instance.

step 1. Fresh installation of centos 7

setp 2. Added the required Yum repository for mysql-community-server.version.noarch.rpm.

setp 3. Installed yum mysql-community-server (The mysql version is 5.7.10 installed.)

step 4. Checked the mysqld status with systemctl status mysqld.

step 5. systemctl start mysqld.services

step 6. now i want to check mysql shell.

step 7. I had checked the mysql client also it is already installed while mysql commuinty server has installed.

step 8. For the mysql root user not prompted the password so i had tried with the default password . like mysql -u root -p mysql

It is asking Enter password .
tried with different password but i am getting the error like 
ERROR 1045 (28000) : Access denied for user 'root'@'localhost' (using password: YES).
Another way also tried with mysql_secure_installation but i am getting the same error. i dont know how to resolve this. 
Mysqladmin -u root password = 'newpassword' also tried. But i am getting the access denied error. 

The root password not yet set up but access denied. i dont know how to resolve this . Please help me to resolve. Thanks in advance.

After first instance successfully running only i can proceed with multiple instances and need to configure mysqlfabric. Please help me.

I had referred the mysql installation link http://sharadchhetri.com/2014/07/31/how-to-install-mysql-server-5-6-on-centos-7-rhel-7/

like image 700
Dharmaraja.k Avatar asked Sep 11 '25 12:09

Dharmaraja.k


1 Answers

Finally i resolved the problem on centos7 with mysqlserver 5.7.10.

The reason behind is mysql server 5.7.10 generating the random password for the mysql.

so the following commands will be resolved my problem.

step 1. login as root

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

step 3. It will show the password.

step 4. Copy the password and do the following ,

4.1 mysql -u root -p

4.2 Enter the temporary password

4.3 The mysqlserver 5.7.10 has security so you need to update the password for further process in mysql shell.

so do the following

ALTER USER 'root'@'localhost' identified by 'your new password';
ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER;

4.4 Now do all the process in mysql shell.

Thanks to all.

like image 141
Dharmaraja.k Avatar answered Sep 13 '25 01:09

Dharmaraja.k