Reputation: 310
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.
Upvotes: 2
Views: 714
Reputation: 199
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.
Upvotes: 1
Reputation: 12904
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.
Upvotes: 2