Web Hosting Talk







View Full Version : MySQL Problem


shimmy
03-06-2001, 09:47 PM
Hi,
I had MySQL installed fine, but I was just trying to change the MySQL default password for "root", but I messed up and Typed
-------------------------------------------

mysql> update user set Password='mypassword' where User="root";
Query OK, 2 rows affected (0.02 sec)
Rows matched: 2 Changed: 2 Warnings: 0

mysql> flush privileges;
Query OK, 0 rows affected (0.09 sec)

mysql> exit
-------------------------------------------

And now there is no password for "root".

So when I telnet and I type...

mysql -u root

I get the mysql prompt

But when I type,

use mysql;

I now get this error "ERROR 1044: Access denied for user: '@localhost' to database 'mysql'"
Which I never got before.


I can't figure out how to fix it, I tried commands like these...

SET PASSWORD FOR root= mypassword;
or
SET PASSWORD FOR root= 'mypassword';
or
SET PASSWORD FOR root= (mypassword);

but nothing works, I guess since I cant type "use mysql;"

Any ideas on what I can do?

Travis
03-06-2001, 10:13 PM
Oops. :)

Please, read the MySQL instructions before trying to change passwords - you have to use a function to encrypt the password before storing it in the database.

As it is, the easiest way around this is to re-install MySQL if that's an option. Otherwise, you'll need to blow away the MySQL database and re-run the initialization script that comes with MySQL.

shimmy
03-10-2001, 08:30 PM
Hi,
I tried to uninstall it by typing...
exec /var/lib/cobalt/uninstallers/MySQL-3.22.32-1.uninst

But it say "permission denied"

Do you know what I can do?

Travis
03-10-2001, 08:35 PM
I'll have to yield to someone more familiar with RaQs on this one...

vizi
03-10-2001, 09:19 PM
You don't need to reinstall. But what travis said is right, you didn't set the password correctly. Do this:

UPDATE user SET Password=PASSWORD('new_password') WHERE user='root';

Then you can do: mysqladmin reload

Travis
03-10-2001, 11:36 PM
How is he going to do that if he can no longer log in as the root user?

vizi
03-11-2001, 01:26 AM
My bad Travis. Didn't see the part where he was getting the denined error.

You may want to try and reset the configuration again to redo the permisions. Try:

/path/to/mysql/scripts/mysql_install_db

If that doesn't work, drop the mysql database itself and then rerun the script above. To drop the mysql table, just do:

mysqladmin drop mysql

If that doesn't work, try running the following:

/path/to/mysql/bin/mysql_fix_privilege_tables

And lastly, if that doesn't work, you may want to try something really crazy! First, delete the mysql binary db files and try recreating them. Do:

rm -R /path/to/mysql/data/mysql
/path/to/mysql/scripts/mysql_install_db

If all else fails. Delete all and reinstall. Good luck.