I am new to MySQL. I installed MySQL (version 8) in RHEL 7.7 using yum . Now , I am trying to configure MySQL.
[root@devdbvm278 ~]# cat /etc/my.cnf
# commented lines removed for readability
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
Once the installation was done, I started the mysqld using
# systemctl start mysqld
Now, when I try to log in as root user, I get the following error. I tried to fix it using some stuff I found from googling. But, no luck. Any idea what is wrong ?
[root@devdbvm278 ~]# mysql -u root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
[root@devdbvm278 ~]# mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
[root@devdbvm278 ~]#
[root@devdbvm278 ~]# mysqld_safe --skip-grant-tables
-bash: mysqld_safe: command not found
[root@devdbvm278 ~]# mysqld --skip-grant-tables
2019-08-13T15:53:33.812294Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.17) starting as process 19578
2019-08-13T15:53:33.815432Z 0 [ERROR] [MY-010123] [Server] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!
2019-08-13T15:53:33.815507Z 0 [ERROR] [MY-010119] [Server] Aborting
2019-08-13T15:53:33.815777Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.17) MySQL Community Server - GPL.
[root@devdbvm278 ~]#
# mysqld --version
/usr/sbin/mysqld Ver 8.0.17 for Linux on x86_64 (MySQL Community Server - GPL)