# mysql cannot set password [SOLVED]

## josedb

i followed this guide http://gentoo-wiki.com/HOWTO_Setup_MythTV till to 

 *Quote:*   

> Note: If this is your first time running MySQL, you'll need to run the setup program:

 

but the program says 

 *Quote:*   

> PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
> 
> To do so, start the server, then issue the following commands:
> 
> /usr/bin/mysqladmin -u root password 'new-password'
> ...

 

and when executing 

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

it says  *Quote:*   

> /usr/bin/mysqladmin: connect to server at 'localhost' failed
> 
> error: 'Access denied for user 'root'@'localhost' (using password: NO)'
> 
> 

 

localhost ~ # /usr/bin/mysqladmin -u root password 'new-password'

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

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

localhost ~ # /usr/bin/mysqladmin -u root -h localhost password 'new-password'/usr/bin/mysqladmin: connect to server at 'localhost' failed

error: 'Access denied for user 'root'@'localhost' (using password: NO)'Last edited by josedb on Thu Jan 24, 2008 1:57 am; edited 1 time in total

----------

## magic919

Try adding -p and then blank pw at the prompt.

----------

## josedb

```
localhost ~ # /usr/bin/mysqladmin -p root password 'new-password'

Enter password: 

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

error: 'Access denied for user 'root'@'localhost' (using password: YES)'

```

----------

## magic919

I presume you have tried using your new password?  Looks like it must have one set.

----------

## josedb

 *magic919 wrote:*   

> I presume you have tried using your new password?  Looks like it must have one set.

 

and how do i test it?

----------

## magic919

mysql -u root -p

----------

## josedb

```
localhost ~ # mysql -u root -p

Enter password: 

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

localhost ~ # 

```

----------

## magic919

Ok.  Hard to tell where you've got awry.  Just reset it.

http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html#resetting-permissions-unix

----------

## josedb

no luck

```
localhost ~ # mysqld_safe --init-file=/root/mysql-init 

nohup: ignoring input and redirecting stderr to stdout

Starting mysqld daemon with databases from /var/lib/mysql

STOPPING server from pid file /var/run/mysqld/mysqld.pid

080122 22:28:13  mysqld ended

localhost ~ # 

```

----------

## josedb

ready with this

Stop mysqld and restart it with the --skip-grant-tables --user=root 

mysql> UPDATE mysql.user SET Password=PASSWORD('newpwd')      ->                   WHERE User='root';  mysql> FLUSH PRIVILEGES;

----------

