# [gelöst] MYSQL Error1045

## suniles

Hallo,

rauf mir bald die Haare!! Ich komme als als root nicht in mysql rein. Hat jemand noch einen Tip?

Fehlermeldung: 

bash>mysql -u root

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

Hab schon unter diesem Link versucht die ensprechenden Schritte versucht:

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

my.cnf

------------------------------Schnipp------------------------------------

# /etc/mysql/my.cnf: The global mysql configuration file.

# $Header: /var/cvsroot/gentoo-x86/dev-db/mysql/files/my.cnf-4.0.14-r1,v 1.2 2004/07/18 02:47:43 dragonheart Exp $

#

# This file can be simultaneously placed in three places:

# 1. /etc/mysql/my.cnf to set global options.

# 2. /var/lib/mysql/my.cnf to set server-specific options.

# 3. ~/.my.cnf to set user-specific options.

#

# One can use all long options that the program supports.

# Run the program with --help to get a list of them.

#

# The following values assume you have at least 32M RAM!

[client]

#password	= 

port		= 3306

socket		= /var/run/mysqld/mysqld.sock

[safe_mysqld]

err-log		= /var/log/mysql/mysql.err

[mysqld]

skip-innodb

user		= mysql

pid-file	= /var/run/mysqld/mysqld.pid

socket		= /var/run/mysqld/mysqld.sock

log-error	= /var/log/mysql/mysqld.err

# If set, mysql logs all queries(general query log). This will be deprecated in

# 5.0. This logs all queries, even error queries and is slow.

# log          = /var/log/mysql/mysql.log

#

# If you really need logging, use rather binary logging. Especially when doing

# replication. Read

# file:/usr/share/doc/mysql-*/manual.html.gz#Replication

# You can use PURGE MASTER LOGS TO '$hostname-bin.010' to get rid of old logs

# from $hostname-bin.01 up to $hostname-bin.09 while the slave server is

# running.

# Before doing that, check which logfile slave curently uses by running

# mysql> SHOW SLAVE STATUS

# To list logfiles on master do:

# mysql> SHOW MASTER LOGS

# Then use PURGE for those not needed anymore only! Never remove the files

# manually!

#

# Also consult RESET MASTER and RESET SLAVE commands before doing any changes

# mysql> RESET MASTER - Deletes all binary logs listed in the index

#                       file, resetting the binlog index file to be empty.

# mysql> RESET SLAVE - Makes the slave forget its replication position in

#                      the master logs.

# mysql> SET SQL_LOG_BIN=0  - this turns off logging (execute on MASTER only)

# mysql> SET SQL_LOG_BIN=1  - this turns on logging (execute on MASTER only)

#

# log-bin

# set-variable  = binlog-do-db=non_existant

# set-variable  = binlog-ignore-db=database_name

#

# server-id has to unique for each master or slave in your network,

# lets use last number from IP address

# server-id      = 207

basedir		= /usr

datadir		= /var/lib/mysql

tmpdir		= /tmp

language	= /usr/share/mysql/english

skip-locking

set-variable	= key_buffer=16M

set-variable	= max_allowed_packet=1M

set-variable	= thread_stack=128K

# keep secure by default!

bind-address    = 127.0.0.1

port		= 3306

# this can make it even more secure:

#skip-networking

[mysqldump]

quick

set-variable	= max_allowed_packet=1M

[mysql]

#no-auto-rehash	# faster start of mysql but no tab completition

[isamchk]

set-variable	= key_buffer=16M

------------------------------Schnipp------------------------------------

mysql  Ver 14.7 Distrib 4.1.8, for pc-linux-gnu (i686)

dev-db/mysql

      Latest version available: 4.1.8-r1

      Latest version installed: 4.1.8-r1

      Size of downloaded files: 21,765 kB

----------

## .maverick

mysql -u root -p

----------

## suniles

 *.maverick wrote:*   

> mysql -u root -p

 

leider nein:-(

bash>mysql -u root -p

Enter password: *********

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

bash>mysql -u root -p

Enter password: 

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

----------

## benjamin200

ganz klar, du hast dein Passwort vergessen, sind schon Datenbanken angelegt worden? Wichtiger Inhalt?

----------

## suniles

 *benjamin200 wrote:*   

> ganz klar, du hast dein Passwort vergessen, sind schon Datenbanken angelegt worden? Wichtiger Inhalt?

 

Nee, is noch ganz frisch. Keine Datenbank!! 

Habe es anfangs weder mit noch ohne Passwort geschafft.

----------

## pablo_supertux

Dann versuche mit

```

/usr/bin/mysqladmin -u root -h localhost password dein_passwort_hier

```

um root Passwort neu zu setzen.

----------

## ruth

hallo,

```

 In a Unix environment, the procedure for resetting the root password is as follows:

   1.

      Log on to your system as either the Unix root user or as the same user that the mysqld server runs as.

   2.

      Locate the .pid file that contains the server's process ID. The exact location and name of this file depend on your distribution, hostname, and configuration. Common locations are /var/lib/mysql/, /var/run/mysqld/, and /usr/local/mysql/data/. Generally, the filename has the extension of .pid and begins with either mysqld or your system's hostname.

      You can stop the MySQL server by sending a normal kill (not kill -9) to the mysqld process, using the pathname of the .pid file in the following command:

shell> kill `cat /mysql-data-directory/host_name.pid`

      Note the use of backticks rather than forward quotes with the cat command; these cause the output of cat to be substituted into the kill command.

   3.

      Restart the MySQL server with the special --skip-grant-tables option:

shell> mysqld_safe --skip-grant-tables &

   4.

      Set a new password for the root@localhost MySQL account:

shell> mysqladmin -u root flush-privileges password "newpwd"

      Replace ``newpwd'' with the actual root password that you want to use.

   5.

      You should be able to connect using the new password.

```

siehe:

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

RTFM

*scnr*

Gruss

ruth

----------

## suniles

 *pablo_supertux wrote:*   

> Dann versuche mit
> 
> ```
> 
> /usr/bin/mysqladmin -u root -h localhost password dein_passwort_hier
> ...

 

/usr/bin/mysqladmin -u root -h localhost password xxxxxx         

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

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

Hinweis mysqld ist gestartet!!

----------

## benjamin200

wenn du nochmals...

```

emerge mysql

```

ausführst bekommst du doch ein paar Tipps (passwort etc.) angezeigt. Dort steht ein Kommando zu "Ebuild Config", wenn du das ausführst, wir dass Passwort überschrieben und eventuell vorhandene Datenbanken gelöscht. Wenn du es nicht findest, poste einfach den letzen Output nach dem Kompiliervorgang.

Viel Erfolg  :Smile: 

Gruß,

Benjamin

----------

## benjamin200

 *Quote:*   

> 
> 
> Hinweis mysqld ist gestartet!!
> 
> 

 

klar, sonst würde nicht das hier kommen:

```

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

```

----------

## suniles

 *benjamin200 wrote:*   

>  *Quote:*   
> 
> Hinweis mysqld ist gestartet!!
> 
>  
> ...

 

Also habe alles neu gemergt  

danack: ebuild /var/db/pkg/dev-db/mysql-4.1.8-r1/mysql-4.1.8-r1.ebuild config

danach: revdep-rebuild

bash>  /usr/bin/mysqladmin -u root -h localhost password 'xxxxx'

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

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

----------

## suniles

 *suniles wrote:*   

>  *benjamin200 wrote:*    *Quote:*   
> 
> Hinweis mysqld ist gestartet!!
> 
>  
> ...

 

Gelöst: ebuild /var/db/pkg/dev-db/mysql-4.1.8-r1/mysql-4.1.8-r1.ebuild config

...und dann dem weiteren Anweisungen folgen!!!

----------

