Seba
Seba

Reputation: 47

Changing root password mysql

Hi i tried to change my root password in mysql and i received an unexpected response. Do you know how can i sett root password?

I get ERROR 1142(42000) UPDATE COMMAND DENIED to user ''@localhost' for table user

Upvotes: 0

Views: 550

Answers (2)

Fyre
Fyre

Reputation: 1180

It might have happened that you have installed mysql as root. Try this

su - rcmysql stop
rm -fr /var/lib/mysql/*
rcmysql start
mysqladmin -u root password 'rawr'

Removing the mysql package does not remove the databases (for obvious reasons, there might be important info in it). So if the database was left behind from a previous install, or messed up in some way, reinstalling mysql doesn't fix the problem.

Sometimes people mess up the database by starting mysqld as root manually.

You're supposed to start mysql using the init script (or YaST if you don't know about init scripts). Then mysqld can run as user mysql. Running mysqld as root can change the ownerships of the database files in such a way that you cannot administer the database, nor can you fix the problem by reinstalling.

Upvotes: 0

Jenson
Jenson

Reputation: 635

Looks like you dont have the 'user' doesnt have privileges to change the password...
If you got shell-access you could try this:

mysqladmin --user=root --password='old pw' password 'new pw'

Upvotes: 3

Related Questions