# Mysql server doesnt allow login

## bastibasti

Hi,

I already followed the instructions here:

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

but when I try to run mysql, it gives

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

Any advice?

----------

## chiefbag

To setup root password for first time

```
mysqladmin -u root password NEWPASSWORD
```

if you want to change (or update) a root password

```
 mysqladmin -u root -p'oldpassword' password newpass
```

----------

## Stonic

alternatively, after emerging mysql, you can use the emerge --config mysql for a nifty script to create the tables and root PW.

----------

## bastibasti

mmhh that dont work. How can I import a complete database from "var/lib/mysql_old/databasename/" into a new install?

----------

