# Mysql headaches.

## WeeTzz

I've installed mysql 3.23 and right away it tells me to do this:  

```

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !

This is done with:

/etc/init.d/mysql start  (you have to start the server first!)

/usr/bin/mysqladmin -u root  password 'new-password'

/usr/bin/mysqladmin -u root -h starscream  password 'new-password'

See the manual for more instructions.

```

ok so i start it, then I do what it says and type:

```
/usr/bin/mysqladmin -u root password thisreallyisntmypassword
```

Then I type the next part and get an error:

```
root@starscream conf.d # /usr/bin/mysqladmin -u root -h localhost password thisreallyisntmypassword

/usr/bin/mysqladmin: connect to server at 'localhost' failed

error: 'Access denied for user: 'root@localhost' (Using password: NO)'

```

'

I'm not sure what I did, but I can't reverse it and unmerging it doesn't get rid of database so I can start over and retry.

I can exit my root shell and access mysql just fine, but not as root and I can't do any admin stuff anymore.  what the heck?

anyone know?

[/code]

----------

## Koon

Maybe you should try :

```
/usr/bin/mysqladmin -u root@localhost password 'new-password'
```

Hope this helps.

-K

----------

## WeeTzz

problem is I can't even use the tool anymroe :-/

----------

## WeeTzz

 *Koon wrote:*   

> Maybe you should try :
> 
> ```
> /usr/bin/mysqladmin -u root@localhost password 'new-password'
> ```
> ...

 

I did a new install, and i tried what you said above and i got this: 

```

root@starscream / # /usr/bin/mysqladmin -u root@localhost password fakepassword

/usr/bin/mysqladmin: unable to change password; error: 'Access denied for user:

'@localhost' to database 'mysql''

```

wtf?

i just installed it.!@#J@!???

----------

## joycea

Maybe if you try removing /var/lib/mysql directory.  I don't think re-emerging would have changed this.  This is the mysql data directory so I imagine this is where mysql will be saving the root password.

Don't do this if you actually have data in the database, but it seems as though you don't as you are just starting to install it.

----------

## xedx

do 

# mysql -u root -p

then wait for the password prompt

----------

## ARC2300

Delete the mysql directory, rerun the script, exit to normal user lever, then type "mysql -u root mysql" and you should be able to get in.  Then type "SET PASSWORD FOR root@localhost=password('insertyourpasswordhere');".

It must be typed like that.

It took me a good 2 hours to figure out.  Check out http://www.mysql.com/documentation/mysql/bychapter/manual_MySQL_Database_Administration.html#Default_privileges

That's where I found out how to do it, and it was by total accident.  However, I forgot to use "mysql" in my USE tags, so crap got screwed up and I had to emerge stuff again.   :Sad: 

Anyways, hope that helps.

----------

## billatq

Well, it's probably too late to be useful for the poster of the thread, but in case someone hits this in a search, you can usually reset the mysql root password by stopping the daemon via the initi scripts, and then restarting it manually with --skip-grant-tables (as root)

This does more or less what it says and ignores the permissions so that you can reset the mysql root password. Then you can kill the daemon and restart it again with the init scripts.

----------

