MySQL how to reset root password in Linux (Debian, Ubuntu, etc.)

MySQL how to reset root password in Linux (Debian, Ubuntu, etc.)

Linuxoid

7 лет назад

12,583 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@pauloTx
@pauloTx - 02.01.2023 16:15

THANK YOU VERY MUCH SIR

Ответить
@vahidalavi
@vahidalavi - 19.12.2021 10:20

Thanks... you saved me. Thanks

Ответить
@alizee3687
@alizee3687 - 17.02.2021 22:59

didn't work for me but I give you thumb because I have learn couple of new command from you following is output from my machine hope you can direct me to the right direction

root@Home:/# mysql -u root -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111)
[1]+ Done mysqld_safe --init-file=/temp/1.sq

Next what I'm going to do is search the internet for ERROR code 2002 (HY000) hope I will get somewhere

Ответить
@ahyahya2890
@ahyahya2890 - 25.09.2020 19:11

use mysql;
update user set Password=PASSWORD("password") where User='root';
flush privileges;

Ответить
@sunhsiang6644
@sunhsiang6644 - 06.06.2020 20:47

mysqld_safe Directory '/var/run/mysqld' for UNIX socket file don't exists.

Ответить
@bharathwajan6079
@bharathwajan6079 - 12.10.2019 14:25

It doesn't works for me

Ответить
@AndersJackson
@AndersJackson - 13.12.2018 02:20

Actually, you don't need to stop the MySQL/MariaDB to change the root password. Only use the debian-sys-maint user that Debian packages have to administrate the mysqld.
Login credentials are located in a file, so you only need to tell mysql to use that file/ etc/mysql/debian.cnf for credentials with --defaults-file=/etc/mysql/debian.cnf

No, the file is only readable by root. And if someone have root access to your machine, you are in bigger trouble.

Or just do this, where you change the mariadb-server-version (from memory): sudo dpkg-reconfigure mariadb-server-#.#

Ответить
@AboutFutureUs
@AboutFutureUs - 26.11.2018 12:52

Which keyboard keys do you use to save input in terminal?

Ответить
@alexdlveliz2394
@alexdlveliz2394 - 01.09.2018 08:02

after 20 webpages visited, here I give up, nothing is working

Ответить
@tokyo-boy
@tokyo-boy - 27.08.2018 15:54

this is the one proper solution that worked for me

Ответить