mysql -u root -p
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
https://help.ubuntu.com/community/MysqlPasswordReset
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
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
sudo /etc/init.d/mysql stop
توی متن خطا نوشته که بجای دستور بالایی باید این دستور رو بزنی:sudo service mysql stop
یاsudo stop mysql
توی متن خطا نوشته که بجای دستور بالایی باید این دستور رو بزنی:کد: [انتخاب]sudo service mysql stop
یاکد: [انتخاب]sudo stop mysql
start the mysql client process using this command
mysql -u root
from the mysql prompt execute this command to be able to change any password
FLUSH PRIVILEGES;
Then reset/update your password
SET PASSWORD FOR root@'localhost' = PASSWORD('password');
If you have a mysql root account that can connect from everywhere, you should also do:
UPDATE mysql.user SET Password=PASSWORD('newpwd') WHERE User='root';
Alternate Method:
USE mysql
UPDATE user SET Password = PASSWORD('newpwd')
WHERE Host = 'localhost' AND User = 'root';
And if you have a root account that can access from everywhere:
USE mysql
UPDATE user SET Password = PASSWORD('newpwd')
WHERE Host = '%' AND User = 'root';
For either method, once have received a message indicating a successful query (one or more rows affected), flush privileges:
FLUSH PRIVILEGES;
Then stop the mysqld process and relaunch it with the classical way:
sudo /etc/init.d/mysql stop
sudo /etc/init.d/mysql start
$ sudo mysqld_safe --skip-grant-tables &
۲- بعد :$ sudo mysql -u root mysql
۳- حالا باید پسورد رو تغییر بدی :update user set password=PASSWORD("NEW-ROOT-PASSWORD") where User='root'; flush privileges; exit;
،به $ اول دستورات ایراد میگیره. بدون اونا هم تو مرحله ۲ باز
۱- این دستور رو اجرا کن :کد: [انتخاب]$ sudo mysqld_safe --skip-grant-tables &
۲- بعد :کد: [انتخاب]$ sudo mysql -u root mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
$ sudo mysqld_safe --skip-grant-tables &
$ اول دستورات یعنی در وضعیت غیر مدیر باشی! (نباید تایپ کنی)
MySQL رو Stop کن بعدش خروجی دستور زیر رو اینجا بذار :کد: [انتخاب]$ sudo mysqld_safe --skip-grant-tables &
[1] 5506
yasin@yasin-System-Product-Name:~$ 140509 16:48:04 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.
140509 16:48:04 mysqld_safe Logging to '/var/log/mysql/error.log'.
140509 16:48:04 mysqld_safe A mysqld process already exists
کد: [انتخاب][1] 5506
yasin@yasin-System-Product-Name:~$ 140509 16:48:04 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.
140509 16:48:04 mysqld_safe Logging to '/var/log/mysql/error.log'.
140509 16:48:04 mysqld_safe A mysqld process already exists
$ sudo killall mysqld
بعدش دوباره دستور زیر اجرا کن و خروجی قرار بده :$ sudo mysqld_safe --skip-grant-tables &
نقلقولکد: [انتخاب][1] 5506
yasin@yasin-System-Product-Name:~$ 140509 16:48:04 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.
140509 16:48:04 mysqld_safe Logging to '/var/log/mysql/error.log'.
140509 16:48:04 mysqld_safe A mysqld process already exists
خب MySQL هنوز اجرا هست. واسه همین به حالت Safemode نمیره!
اینبار MySQL رو اینجور Stop کن :کد: [انتخاب]$ sudo killall mysqld
بعدش دوباره دستور زیر اجرا کن و خروجی قرار بده :کد: [انتخاب]sudo mysqld_safe --skip-grant-tables &
[1] 6037
yasin@yasin-System-Product-Name:~$ 140509 17:09:48 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.
140509 17:09:48 mysqld_safe Logging to '/var/log/mysql/error.log'.
140509 17:09:48 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql