Korzystając z tej witryny, zgadzasz się na Polityka prywatności.
Przyjąć
EnterineEnterineEnterine
  • DOM
  • To pro
  • Tech
  • Microsoft
    • Lazur
    • Menedżer konfiguracji/SCCM
    • DPM
    • Orkiestrator
    • Hyper-V.
    • Niejawny tester Microsoft Edge
    • MSI
    • Biuro 365
    • Nieznajomy biura
    • Power bi
    • Skype'a
    • Serwer SQL
    • Zespoły
  • OKNA
    • Centrum administracyjne systemu Windows
    • Klient Windowsa
    • Serwer Windows
  • Lista kolekcji zapytań SCCM
Czytanie: Reset MySQL Root Password on Linux: Przewodnik krok po kroku
Zmiana rozmiaru czcionkiAaa
EnterineEnterine
Zmiana rozmiaru czcionkiAaa
  • DOM
  • To pro
  • Tech
  • Microsoft
  • OKNA
  • Lista kolekcji zapytań SCCM
Szukaj
  • DOM
  • To pro
  • Tech
  • Microsoft
    • Lazur
    • Menedżer konfiguracji/SCCM
    • DPM
    • Orkiestrator
    • Hyper-V.
    • Niejawny tester Microsoft Edge
    • MSI
    • Biuro 365
    • Nieznajomy biura
    • Power bi
    • Skype'a
    • Serwer SQL
    • Zespoły
  • OKNA
    • Centrum administracyjne systemu Windows
    • Klient Windowsa
    • Serwer Windows
  • Lista kolekcji zapytań SCCM
MySQL

Reset MySQL Root Password on Linux: Przewodnik krok po kroku

Opublikowany: Luty 18, 2024
3 Min. odczyt
UDZIAŁ

Reset MySQL Root Password on Linux: Przewodnik krok po kroku.

Losing or forgetting the MySQL root password can be a daunting situation for database administrators. However, on a Linux system, there are methods to reset the MySQL root password and regain access to your database. In this article, we will guide you through the process of resetting the MySQL root password on Linux by modifying the MySQL configuration file (my.cnf), ensuring the security and integrity of your valuable data.

1. The first step in resetting the MySQL root password is to stop the MySQL service to prevent any active connections. Open a terminal on your Linux system and execute the following command:

sudo systemctl stop mysql

2. Next, you need to modify the MySQL configuration file (my.cnf) to disable the authentication process temporarily. Open the file using a text editor:

sudo nano /etc/mysql/my.cnf

Locate the [mysqld] section in the file and add the following line below it:

skip-grant-tables

NOTATKA: In case, when [mysqld] not exist use this code:

[mysqld]
skip-grant-tables

Save the changes and exit the text editor.

3. After modifying the configuration file, you need to restart the MySQL service for the changes to take effect. Execute the following command in the terminal:

sudo systemctl restart mysql

NOTATKA: The MySQL service will now start without checking the user privileges, allowing you to reset the root password without providing the current password.

4. Now that MySQL is running with the authentication process disabled, open a terminal and connect to the MySQL server using the following command:

mysql -u root

Once connected to the MySQL server, execute the following SQL statement to flush privileges:

FLUSH PRIVILEGES;

NOTATKA: Without it, you will get errors on any user operations.

Once connected to the MySQL server, execute the following SQL statement to update the root password:

ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';

Replace ‘new_password’ with your desired password. After running the query, you can exit the MySQL prompt by typing exit Lub quit.

FLUSH PRIVILEGES;
exit;

NOTATKA: Don’t forget to comment code on my.cnf

#[mysqld]
#skip-grant-tables
OZNACZONE:AlmaruxCentOSdbLinuksaMySQLUbuntu
Poprzedni artykuł How to Update Sysmon on Windows – Step by Step Guide
Następny artykuł Nieznajomy biura 2212 dla Windowsa
Zostaw komentarz Zostaw komentarz

Zostaw odpowiedź Anuluj odpowiedź

Twój adres e-mail nie zostanie opublikowany. Wymagane pola są zaznaczone *

Ta strona korzysta z Akismet w celu ograniczenia spamu. Dowiedz się, jak przetwarzane są dane dotyczące Twoich komentarzy.

Tłumaczenie

English中文(简体)DanskNederlandsFrançaisDeutschItaliano한국어PolskiPortuguêsRomânăEspañolУкраїнська
przez Transposh - translation plugin for wordpress

Popularne posty

Wymagania systemowe dla serwera Windows 2016
Serwer Windows
Lista kolekcji zapytań programu Menedżer konfiguracji
Lista kolekcji zapytań programu Menedżer konfiguracji
Configmgr
Nawigacja strukturalna/zarządzana włączona na nowoczesnych stronach w klasycznych witrynach zespołu
Tech
SCCM Nie udało się uzyskać lokalizacji DP w oczekiwanej wersji z MP
Configmgr

Ostatnie posty

Lista kolekcji zapytań programu Menedżer konfiguracji
Aktualizacja podglądu technicznego menedżera konfiguracji systemu 1611
Configmgr
Instalowanie i konfigurowanie Fail2ban dla ochrony SSH na Ubuntu 24.04
Linuksa
Jak sprawdzić strefę czasu w Linux
Linuksa
Włączanie i konfiguracja FirewallD na AlmaLinux
Linuksa

© 2023 Enterine

Przejdź do wersji mobilnej
Witamy z powrotem!

Zaloguj się na swoje konto

Nazwa użytkownika lub adres e-mail
Hasło

Zgubiłeś hasło?