我已经在CentOS上安装了mysql,就像在https://www.linode.com/docs/databases/mysql/how-to-install-mysql-on-centos-7上描述的那样
在第一次安装时,我总是在命令之后收到消息:
数独mysql_secure_installation
错误:用户'root'@'localhost‘的访问被拒绝(使用密码:否)
下面是一些信息:命令+结果
cat /etc/*-释放
CentOS Linux7.3.1611 (Core) NAME="CentOS Linux“VERSION=7 (Core)”ID="centos“ID_LIKE=”ID_LIKE=“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发行版7.3.1611 (核心) CentOS Linux发行版7.3.1611 (核心)
cat /etc/红帽子释放
CentOS Linux7.3.1611版(核心)
cat /proc/版本
Linux3.10.0-327.28.2.el7.x86_64 (builder@kbuilder.dev.centos.org) (gcc版本4.8.3 20140911 (红帽4.8.3-9) (GCC) ) #1 SMP Wed Aug 3 11:11:39 2016年世界协调时
我的主机名不是localhost,但是root总是配置为“localhost”。此外,我还有linux的“root”用户(mysql的同名)--我尝试了linux root用户的密码和空白密码,但仍然得到了相同的错误。
我已经重新安装了mysql,但也出现了同样的错误.
拜托救救我。
谢谢。
发布于 2017-03-31 14:34:59
正如我在MySQL Error: : 'Access denied for user 'root'@'localhost'中所看到的
步骤:
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之后,我通过命令行进行了检查: telnet 3306,这似乎是正确的。
https://stackoverflow.com/questions/43105672
复制相似问题