0

I have installed mysql on CentOS, as described on https://www.linode.com/docs/databases/mysql/how-to-install-mysql-on-centos-7

Always on first installation I got a messagae after the command:

sudo mysql_secure_installation

Error: Access denied for user 'root'@'localhost' (using password: NO)

Here are some informations: commands + results

cat /etc/*-release

CentOS Linux release 7.3.1611 (Core) NAME="CentOS Linux" VERSION="7 (Core)" ID="centos" ID_LIKE="rhel fedora" VERSION_ID="7" PRETTY_NAME="CentOS Linux 7 (Core)" ANSI_COLOR="0;31" CPE_NAME="cpe:/o:centos:centos:7" HOME_URL="https://www.centos.org/" BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7" CENTOS_MANTISBT_PROJECT_VERSION="7" REDHAT_SUPPORT_PRODUCT="centos" REDHAT_SUPPORT_PRODUCT_VERSION="7"

CentOS Linux release 7.3.1611 (Core) CentOS Linux release 7.3.1611 (Core)

cat /etc/redhat-release

CentOS Linux release 7.3.1611 (Core)

cat /proc/version

Linux version 3.10.0-327.28.2.el7.x86_64 (builder@kbuilder.dev.centos.org) (gcc version 4.8.3 20140911 (Red Hat 4.8.3-9) (GCC) ) #1 SMP Wed Aug 3 11:11:39 UTC 2016

My host name is not localhost, but root is always configured to 'localhost'. Also, I have 'root' user for linux (same name for mysql) - I have tried both password of as linux root user and blank password, but still got the same error.

I have re-installed the mysql, but also got the same error.

Please, help.

Thank you.

Eitan
  • 1,286
  • 2
  • 16
  • 55

1 Answers1

0

As I see in MySQL Error: : 'Access denied for user 'root'@'localhost'

The steps:

1.Add skip-grant-tables under [mysqld] (nano etc/my.cnf) 
2.service restart.
3.flush privileges;
4.change root password (root) ALTER USER 'root'@'localhost' IDENTIFIED BY 'NewPassword';
5.Go back to /etc/my.cnf and remove/comment skip-grant-tables
6.Restart Mysql

After that, I have checked by command line: telnet 3306, which seems to be correct.

Community
  • 1
  • 1
Eitan
  • 1,286
  • 2
  • 16
  • 55