2016-05-31 12 views
1

Ich kann mich nicht bei MySQL anmelden. Ich dachte, es war das falsche Passwort und ich habe versucht, das Passwort zu ändern.FEHLER 1045 (28000): Zugriff verweigert für Benutzer 'root' @ 'localhost' (mit Passwort: YES) -Ubuntu

Es besteht keine Notwendigkeit, das Passwort zu ändern. Weil das Passwort richtig ist. Das Passwort stimmt, aber ich kann mich immer noch nicht bei mysql anmelden. Warum? hilf mir bitte, danke. Ich habe viele Methoden ausprobiert.

[email protected]:/home/PC# sudo /etc/init.d/mysql stop 
Rather than invoking init scripts through /etc/init.d, use the service(8) 
utility, e.g. service mysql stop 

Since the script you are attempting to invoke has been converted to an 
Upstart job, you may also use the stop(8) utility, e.g. stop mysql 
mysql stop/waiting 
[email protected]:/home/PC# pkill -9 mysql 
[email protected]:/home/PC# pkill -9 mysqld 
[email protected]:/home/PC# pkill -9 mysqld_safe 
[email protected]:/home/PC# ps -ef |grep mysql 
root 27690 25962 0 19:51 pts/1 00:00:00 grep --color=auto mysql 
[email protected]:/home/PC# kill 27690 
bash: kill: (27690) - No such process 
[email protected]:/home/PC# kill 25962 
[email protected]:/home/PC# ps uaxww | grep -i mysql 
PC 24175 0.7 3.8 818760 156020 ? Sl 19:29 0:10 /usr/lib/firefox/firefox /media/DA94-D856/c/How to Recover_Reset forgotten MySQL root Password on Linux _ 2daygeek.htm 
root 27695 0.0 0.0 13588 944 pts/1 S+ 19:52 0:00 grep --color=auto -i mysql 
[email protected]:/home/PC# kill 27695 
bash: kill: (27695) - No such process 
[email protected]:/home/PC# kill 13588 
bash: kill: (13588) - No such process 
[email protected]PC:/home/PC# sudo mysqld_safe --skip-grant-tables & 
[1] 27701 
[email protected]:/home/PC# 160518 19:53:57 mysqld_safe Can't log to error log and syslog at the same time. Remove all --log-error configuration options for --syslog to take effect. 
160518 19:53:57 mysqld_safe Logging to '/var/log/mysql/error.log'. 
160518 19:53:57 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql 
[email protected]:/home/PC# mysql -uroot 
Welcome to the MySQL monitor. Commands end with ; or \g. 
Your MySQL connection id is 1 
Server version: 5.5.34-0ubuntu0.12.04.1 (Ubuntu) 

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. 

Oracle is a registered trademark of Oracle Corporation and/or its 
affiliates. Other names may be trademarks of their respective 
owners. 

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. 

mysql> use mysql; 
Reading table information for completion of table and column names 
You can turn off this feature to get a quicker startup with -A 

Database changed 
mysql> update user set password=PASSWORD("mypw") where User='root'; 
Query OK, 0 rows affected (0.00 sec) 
Rows matched: 3 Changed: 0 Warnings: 0 

mysql> update user set password=PASSWORD("newpw") where User='root'; 
Query OK, 3 rows affected (0.00 sec) 
Rows matched: 3 Changed: 3 Warnings: 0 

mysql> flush privileges; 
Query OK, 0 rows affected (0.00 sec) 

mysql> quit 
Bye 
[email protected]:/home/PC# sudo /etc/init.d/mysql stop 
Rather than invoking init scripts through /etc/init.d, use the service(8) 
utility, e.g. service mysql stop 

Since the script you are attempting to invoke has been converted to an 
Upstart job, you may also use the stop(8) utility, e.g. stop mysql 
[email protected]:/home/PC# sudo /etc/init.d/mysql start 
Rather than invoking init scripts through /etc/init.d, use the service(8) 
utility, e.g. service mysql start 

Since the script you are attempting to invoke has been converted to an 
Upstart job, you may also use the start(8) utility, e.g. start mysql 
mysql start/running, process 28137 
[email protected]:/home/PC# mysql -u root -p 
Enter password: 
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) 

(oder dpkg-recon mysql-server-5,5)

[email protected]:~$ sudo dpkg-reconfigure mysql-server-5.5 
[sudo] password for PC: 
mysql stop/waiting 
160513 7:09:38 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead. 
mysql start/running, process 4046 
[email protected]:~$ mysql -u root -p 
Enter password: 
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) 
[email protected]:~$ 
sudo /etc/init.d/mysql stop 
sudo mysqld_safe --skip-grant-tables & 
mysql -uroot 
use mysql; 
update user set password=PASSWORD("newpw") where User='root'; 
flush privileges; 
quit 
sudo /etc/init.d/mysql stop 
sudo /etc/init.d/mysql start 

Fehlerprotokoll http://pastebin.com/HN2tGhJJ

etc/mysql/my.cf http://pastebin.com/cMSdGUei

Ich versuchte es es aber ist nicht passiert. Root-Rechte wurden möglicherweise gelöscht. Verwenden Sie mysql; gewähren Sie alle auf . zu 'root' @ 'localhost';

[sudo] password for PC-2: 
[email protected]:/home/PC-2# mysql -u root -pFalanca_mypw 
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) 
[email protected]:/home/PC-2# grep password /etc/mysql/debian.cnf 
password = vwSY1PE7GgDRUbB7 
password = vwSY1PE7GgDRUbB7 
[email protected]:/home/PC-2# mysql -u debian-sys-maint -p 
Enter password: 
Welcome to the MySQL monitor. Commands end with ; or \g. 
Your MySQL connection id is 71 
Server version: 5.5.34-0ubuntu0.12.04.1 (Ubuntu) 

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. 

Oracle is a registered trademark of Oracle Corporation and/or its 
affiliates. Other names may be trademarks of their respective 
owners. 

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. 

mysql> use mysql; 
Reading table information for completion of table and column names 
You can turn off this feature to get a quicker startup with -A 

Database changed 
mysql> grant all on *.* to 'root'@'localhost'; 
ERROR 1045 (28000): Access denied for user 'debian-sys-maint'@'localhost' (using password: YES) 
+0

Benutzer debian-sys-maint hat die Berechtigung, dem Benutzer die Berechtigung zu erteilen – Naruto

+0

Wie kann ich das tun? danke – cem

Antwort

0

Im config (.CNF) Datei von MySql, die folgende Eigenschaft,

bind-address = 0.0.0.0 

Der Standardwert ist 127.0.0.1. Ändern Sie es in 0.0.0.0 und Sie können darauf zugreifen. Otheriwse, es erlaubt nur durch den localhost durch ssh.

+0

Also, wie können wir es auf andere Weise lösen? Ich muss eine Verbindung zu 127.0.0.1 herstellen. Auf dem Server befindet sich ein Skript. Ich habe vorher keine Probleme mit 127.0.0.1 Danke. – cem

+0

Ich habe eine Lösung für dieses Problem in C# bereitgestellt. Es ist [hier] (http://stackoverflow.com/questions/32603982/connection-to-mysql-from-net-using-ssh-net-library/36517176#36517176). –

+0

Wir verwenden nicht ssh. Der Server ist physisch hier. Dieser private Server. danke – cem

Verwandte Themen