mysql root password on specified host (not localhost)
I've lost the root user password on my mythtv database server. I first noticed a problem when updating packages and getting a complaint from mythtv-database. I tried to run "dpkg-reconfigure --force mythtv-database" and got an error. I am running debian squeeze.
I've gone through the procedures to reset the root password using mysqld-safe, and it works for localhost. But, when I try "mysql -h192.168.0.4 -uroot -proot mysql" I get the following: Code:
ERROR 1045 (28000): Access denied for user 'root'@'192.168.0.4' (using password: YES) |
try -h 127.0.0.1 or even
-h localhost 192.168.0.4 is NOT the localhost even if it resolves locally and I believe it has something to do with /etc/my.cnf |
Quakeboy02,
The user table in the database named mysql can be used to identify the "host" associated with a particular attempt to access the DB. It is the combination of host and user that is used to control access. So if myth is using the specific host IP rather than the string "localhost", it could be locked out. The same thing applies to any attempt to access mysql from the command line. When you reset the root/admin password for the local host, you might need to use that admin access from the local host, to reset the password for admin access from 192.168.0.4, depending on how the DB was set up. In general, if the IP you mentally associate with your machine is 192.168.0.4, thinking of that as different than "localhost" is not necessarily intuitive, but computers are more literal minded than Humans. As Habitual effectively indicated, with Linux the string "localhost" tends to be associated with the IP 127.0.0.1. |
Guys. I understand that 192.168.0.4 is not localhost. That's why I was careful to point out the problem is attached to 192.168.0.4. The problem is that I don't know what to do with that information. How, exactly, do I set the root password on 192.168.0.4?
|
Oh duh! I figured it out. Execute the following as root in the localhost database connection:
Code:
mysql > update user set password=PASSWORD("root") where user="root@192.168.0.4"; |
All times are GMT -5. The time now is 09:12 AM. |