即使在正确的“yum删除”之后,MySQL也会保留早期安装的密码。 & “百胜安装”
我在 CentOS 上使用 MySQL 服务器。我'yum remove'
MySQL 服务器,然后再次'yum install'
它。 当我尝试使用 'mysqladmin'
为 'root'
设置新密码时...它引发了错误。 一些后续操作表明它仍然具有早期安装的根凭证。
~~~~~
尝试更多的东西,我在 '/etc/my.cnf'
中手动设置 'old_password=0'
,然后尝试重新安装。它仍然使用较早的密码。
I'm using MySQL-Server over CentOS. I 'yum remove'
the MySQL-server and then again 'yum install'
it.
When I tried setting up a new password for 'root'
using 'mysqladmin'
... it raised an error.
Some following up showed it still had earlier-installation's root credential working for it.
~~~~~
Trying some more stuff, I manually set 'old_password=0'
in '/etc/my.cnf'
and then tried re-installing. It still had the earlier password working for it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
听起来好像卸载/安装时 mysql 表没有被删除/替换。我不确定它们在 CentOs 上的位置(/var/lib/mysql?),但如果您手动删除它们,它应该可以工作。
Sounds like the mysql tables are not being removed/replaced when uninstalling/installing. I am not sure where they are located on CentOs (/var/lib/mysql?), but if you remove these manually, it should work.
以 root 身份登录控制台
使用su -
root 密码:_
var/lib 移动到目录 /var/lib/
然后使用命令
cd /
现在提供此命令来删除现有的 mysql 数据库:
rm -rf mysql
此命令将删除 mysql 的现有数据库,该数据库还包含用户表,其中存储了所有 mysql 用户的密码,包括 root。
删除数据库目录及其所有关联文件后,使用此命令重新安装 mysql
yum -y install mysql-server
安装后,您将使用默认设置安装新的 mysql
,并且 root 将没有密码。
您可以从这里继续。
这对我有用。
login to console as root using
su -
root password: _
then move to the directory /var/lib/
using the command
cd /var/lib
now provide this command to delete the existing mysql database :
rm -rf mysql
This command will remove the existing database of mysql which also contains user table where the password for all mysql users are stored including the root.
After removing the database directory and all the associated files with it rum this command to reinstall mysql
yum -y install mysql-server
after installation you will have fresh mysql installed with default settings
and root will have no password.
You can go ahead from here.
This worked for me.