[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cobalt-users] MYSQL Password [off-topic]



Hi Danny,

The MySQL users are not part of the main system, thus they don't appear in
the passwd document. Possibly you have one user called 'mysql' or
equivalents. This user is normally for running the database for common use.

Both, the main system and your mysql server have seperated user tables and
the user name doesn't have to be the same.

To regain control, you first have to shutdown the mysql server.
You do this providing you have no access to the mysql server by becoming
root and:

[root@raq root]$ kill <pid>

get the process_id of mysqld or safe_mysql (this one which is running by
user root) by typing 'top', first.

If that fails, perhaps because mysql server hangs, do it the hard way:

[root@raq root]$ kill -9 <pid>

The latter may cause some problems with mysql tables. So check and repair
with myisamchk and isamchk before you restart the mysql server.

Now you can restart the server with skipping the tables mysql uses to
confirm different users and rights:

[root@raq root]$ /usr/sbin/mysqld --skip-grant-tables

Now you can connect to mysql without any password as root:

[root@raq root]$ mysql -uroot

Once connected it's time to set a new password for the mysql root user
(which should be different from you admin/root password):

mysql> UPDATE user  SET Password=PASSWORD("<your new password here>")
    -> WHERE User="root";
...
    -> quit

Check the status of the mysql server:

[root@raq root]$ mysqladmin -uroot status

If this does _not_ fail you have to give your mysql server a light punch on
the neck, as it has to reload its grant tables:

[root@raq root]$ mysqladmin -uroot reload

Do the status check again (without -p argument as above). If successfull
again you have to try again from top. Normally, mysql server denies access
from this point.

Now you try the positive way:

[root@raq root]$ mysql -uroot -p

Enter your password as prompted.

So let's do the last thing: Again you shutdown your mysql server and restart
it 'safe mode' (as normal).

If your Raq has a user called 'mysql' (as RedHat rpms do) or 'mysqladm' you
should become this user (su - mysqladm) to run mysql as the database server
does not need run with root privileges.

[mysqladm@raq dir]$ /usr/bin/safe_mysqld

... and life will be fine again.

Good luck, Danny.

Regards,

Hendrik.
-
hr@xxxxxxxxxx

> I had a programmer who set up a mysql database on a RAQ4 server.  Apperantly
> he set up MYSQL with a password.
> Would this be the account listed in  /etc/passwd as mysql
> 
> Since there is most likely  no way to discover or recover the password, How
> would I reset the password ?
> 
> Is it a function of mysql  (mysql -p )
> 
> or is it set in the OS
> 
> Would this work
> 
> #passwd mysql xyz123
> 
> I am searching the web as I type
> 
> -Danny
> dcd@xxxxxxxxxxxxxxxxxx
> 
> 
> 
> 
> _______________________________________________
> cobalt-users mailing list
> cobalt-users@xxxxxxxxxxxxxxx
> To Subscribe or Unsubscribe, please go to:
> http://list.cobalt.com/mailman/listinfo/cobalt-users
>