我是MySQL的新手。我使用yum在RHEL7.7中安装了MySQL (版本8)。现在,我正在尝试配置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安装完成后,我将使用
# systemctl start mysqld现在,当我尝试以root用户身份登录时,我会得到以下错误。我试着用谷歌上找到的东西来修复它。但是,没有运气。知道是怎么回事吗?
[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)发布于 2019-08-14 02:48:02
在文档的安全性部分中,它指出:
如果不知道初始随机密码,请查看服务器错误日志。
尝试运行以下命令。它适用于我的5.7安装(它有与8.0版本的文档相同的说明):
sudo grep 'temporary password' /var/log/mysqld.log它应该告诉您用于root的初始密码。
https://dba.stackexchange.com/questions/245240
复制相似问题