Mysql 8 mengubah kata sandi root

Apakah Anda lupa database MySQL Anda

● mysql.service - MySQL Community Server
      Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
      Active: inactive (dead) since Mon 2021-05-31 11:01:15 UTC; 1min 15s ago
     Process: 1446 ExecStart=/usr/sbin/mysqld (code=exited, status=0/SUCCESS)
    Main PID: 1446 (code=exited, status=0/SUCCESS)
      Status: "Server shutdown complete"
 May 31 07:57:50 ubuntu2004.localdomain systemd[1]: Starting MySQL Community Server…
 May 31 07:57:51 ubuntu2004.localdomain systemd[1]: Started MySQL Community Server.
 May 31 11:01:14 ubuntu2004.localdomain systemd[1]: Stopping MySQL Community Server…
 May 31 11:01:15 ubuntu2004.localdomain systemd[1]: mysql.service: Succeeded.
 May 31 11:01:15 ubuntu2004.localdomain systemd[1]: Stopped MySQL Community Server.
1 kata sandi pengguna? . Panduan langkah demi langkah ini menjelaskan cara mengatur ulang kata sandi root di MySQL 8 di Ubuntu 20. 04 sistem operasi

Catatan. Seperti yang mungkin sudah Anda ketahui, pengguna root MySQL menggunakan plugin

● mysql.service - MySQL Community Server
      Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
      Active: inactive (dead) since Mon 2021-05-31 11:01:15 UTC; 1min 15s ago
     Process: 1446 ExecStart=/usr/sbin/mysqld (code=exited, status=0/SUCCESS)
    Main PID: 1446 (code=exited, status=0/SUCCESS)
      Status: "Server shutdown complete"
 May 31 07:57:50 ubuntu2004.localdomain systemd[1]: Starting MySQL Community Server…
 May 31 07:57:51 ubuntu2004.localdomain systemd[1]: Started MySQL Community Server.
 May 31 11:01:14 ubuntu2004.localdomain systemd[1]: Stopping MySQL Community Server…
 May 31 11:01:15 ubuntu2004.localdomain systemd[1]: mysql.service: Succeeded.
 May 31 11:01:15 ubuntu2004.localdomain systemd[1]: Stopped MySQL Community Server.
2 untuk mengautentikasi dengan server MySQL di sistem Ubuntu yang menjalankan MySQL 5. 7 dan versi yang lebih baru. Jadi Anda dapat masuk ke server MySQL sebagai
● mysql.service - MySQL Community Server
      Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
      Active: inactive (dead) since Mon 2021-05-31 11:01:15 UTC; 1min 15s ago
     Process: 1446 ExecStart=/usr/sbin/mysqld (code=exited, status=0/SUCCESS)
    Main PID: 1446 (code=exited, status=0/SUCCESS)
      Status: "Server shutdown complete"
 May 31 07:57:50 ubuntu2004.localdomain systemd[1]: Starting MySQL Community Server…
 May 31 07:57:51 ubuntu2004.localdomain systemd[1]: Started MySQL Community Server.
 May 31 11:01:14 ubuntu2004.localdomain systemd[1]: Stopping MySQL Community Server…
 May 31 11:01:15 ubuntu2004.localdomain systemd[1]: mysql.service: Succeeded.
 May 31 11:01:15 ubuntu2004.localdomain systemd[1]: Stopped MySQL Community Server.
_1 pengguna dengan perintah
● mysql.service - MySQL Community Server
      Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
      Active: inactive (dead) since Mon 2021-05-31 11:01:15 UTC; 1min 15s ago
     Process: 1446 ExecStart=/usr/sbin/mysqld (code=exited, status=0/SUCCESS)
    Main PID: 1446 (code=exited, status=0/SUCCESS)
      Status: "Server shutdown complete"
 May 31 07:57:50 ubuntu2004.localdomain systemd[1]: Starting MySQL Community Server…
 May 31 07:57:51 ubuntu2004.localdomain systemd[1]: Started MySQL Community Server.
 May 31 11:01:14 ubuntu2004.localdomain systemd[1]: Stopping MySQL Community Server…
 May 31 11:01:15 ubuntu2004.localdomain systemd[1]: mysql.service: Succeeded.
 May 31 11:01:15 ubuntu2004.localdomain systemd[1]: Stopped MySQL Community Server.
4 selama Anda tahu kata sandi
● mysql.service - MySQL Community Server
      Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
      Active: inactive (dead) since Mon 2021-05-31 11:01:15 UTC; 1min 15s ago
     Process: 1446 ExecStart=/usr/sbin/mysqld (code=exited, status=0/SUCCESS)
    Main PID: 1446 (code=exited, status=0/SUCCESS)
      Status: "Server shutdown complete"
 May 31 07:57:50 ubuntu2004.localdomain systemd[1]: Starting MySQL Community Server…
 May 31 07:57:51 ubuntu2004.localdomain systemd[1]: Started MySQL Community Server.
 May 31 11:01:14 ubuntu2004.localdomain systemd[1]: Stopping MySQL Community Server…
 May 31 11:01:15 ubuntu2004.localdomain systemd[1]: mysql.service: Succeeded.
 May 31 11:01:15 ubuntu2004.localdomain systemd[1]: Stopped MySQL Community Server.
5 pengguna sistem Anda. Dalam hal ini, kata sandi MySQL
● mysql.service - MySQL Community Server
      Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
      Active: inactive (dead) since Mon 2021-05-31 11:01:15 UTC; 1min 15s ago
     Process: 1446 ExecStart=/usr/sbin/mysqld (code=exited, status=0/SUCCESS)
    Main PID: 1446 (code=exited, status=0/SUCCESS)
      Status: "Server shutdown complete"
 May 31 07:57:50 ubuntu2004.localdomain systemd[1]: Starting MySQL Community Server…
 May 31 07:57:51 ubuntu2004.localdomain systemd[1]: Started MySQL Community Server.
 May 31 11:01:14 ubuntu2004.localdomain systemd[1]: Stopping MySQL Community Server…
 May 31 11:01:15 ubuntu2004.localdomain systemd[1]: mysql.service: Succeeded.
 May 31 11:01:15 ubuntu2004.localdomain systemd[1]: Stopped MySQL Community Server.
1 MySQL tidak perlu diubah. Jika Anda telah mengubah metode autentikasi untuk pengguna root MySQL menjadi
● mysql.service - MySQL Community Server
      Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
      Active: inactive (dead) since Mon 2021-05-31 11:01:15 UTC; 1min 15s ago
     Process: 1446 ExecStart=/usr/sbin/mysqld (code=exited, status=0/SUCCESS)
    Main PID: 1446 (code=exited, status=0/SUCCESS)
      Status: "Server shutdown complete"
 May 31 07:57:50 ubuntu2004.localdomain systemd[1]: Starting MySQL Community Server…
 May 31 07:57:51 ubuntu2004.localdomain systemd[1]: Started MySQL Community Server.
 May 31 11:01:14 ubuntu2004.localdomain systemd[1]: Stopping MySQL Community Server…
 May 31 11:01:15 ubuntu2004.localdomain systemd[1]: mysql.service: Succeeded.
 May 31 11:01:15 ubuntu2004.localdomain systemd[1]: Stopped MySQL Community Server.
7 atau
● mysql.service - MySQL Community Server
      Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
      Active: inactive (dead) since Mon 2021-05-31 11:01:15 UTC; 1min 15s ago
     Process: 1446 ExecStart=/usr/sbin/mysqld (code=exited, status=0/SUCCESS)
    Main PID: 1446 (code=exited, status=0/SUCCESS)
      Status: "Server shutdown complete"
 May 31 07:57:50 ubuntu2004.localdomain systemd[1]: Starting MySQL Community Server…
 May 31 07:57:51 ubuntu2004.localdomain systemd[1]: Started MySQL Community Server.
 May 31 11:01:14 ubuntu2004.localdomain systemd[1]: Stopping MySQL Community Server…
 May 31 11:01:15 ubuntu2004.localdomain systemd[1]: mysql.service: Succeeded.
 May 31 11:01:15 ubuntu2004.localdomain systemd[1]: Stopped MySQL Community Server.
8, ikuti langkah-langkah di bawah ini untuk mereset kata sandi
● mysql.service - MySQL Community Server
      Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
      Active: inactive (dead) since Mon 2021-05-31 11:01:15 UTC; 1min 15s ago
     Process: 1446 ExecStart=/usr/sbin/mysqld (code=exited, status=0/SUCCESS)
    Main PID: 1446 (code=exited, status=0/SUCCESS)
      Status: "Server shutdown complete"
 May 31 07:57:50 ubuntu2004.localdomain systemd[1]: Starting MySQL Community Server…
 May 31 07:57:51 ubuntu2004.localdomain systemd[1]: Started MySQL Community Server.
 May 31 11:01:14 ubuntu2004.localdomain systemd[1]: Stopping MySQL Community Server…
 May 31 11:01:15 ubuntu2004.localdomain systemd[1]: mysql.service: Succeeded.
 May 31 11:01:15 ubuntu2004.localdomain systemd[1]: Stopped MySQL Community Server.
1 dari database MySQL

Atur Ulang Kata Sandi Root Di MySQL 8 Di Ubuntu Linux

1. Pertama, hentikan layanan MySQL menggunakan perintah

$ sudo systemctl stop mysql
_

Ini akan menghentikan layanan MySQL jika sedang berjalan. Anda dapat memverifikasi status layanan MySQL dengan perintah

$ sudo systemctl status mysql

Keluaran sampel

● mysql.service - MySQL Community Server
      Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
      Active: inactive (dead) since Mon 2021-05-31 11:01:15 UTC; 1min 15s ago
     Process: 1446 ExecStart=/usr/sbin/mysqld (code=exited, status=0/SUCCESS)
    Main PID: 1446 (code=exited, status=0/SUCCESS)
      Status: "Server shutdown complete"
 May 31 07:57:50 ubuntu2004.localdomain systemd[1]: Starting MySQL Community Server…
 May 31 07:57:51 ubuntu2004.localdomain systemd[1]: Started MySQL Community Server.
 May 31 11:01:14 ubuntu2004.localdomain systemd[1]: Stopping MySQL Community Server…
 May 31 11:01:15 ubuntu2004.localdomain systemd[1]: mysql.service: Succeeded.
 May 31 11:01:15 ubuntu2004.localdomain systemd[1]: Stopped MySQL Community Server.

Mysql 8 mengubah kata sandi root
Hentikan layanan MySQL

2. Selanjutnya, mulai server MySQL tanpa pemeriksaan izin apa pun. Untuk melakukannya, jalankan

$ sudo systemctl edit mysql

Ini akan membuka

$ sudo systemctl edit mysql
_0
$ sudo systemctl edit mysql
1 file konfigurasi editor teks default Anda. Dalam kasus saya, ini adalah
$ sudo systemctl edit mysql
_2 editor

Tambahkan baris berikut di dalamnya

[Service]
ExecStart=
ExecStart=/usr/sbin/mysqld --skip-grant-tables --skip-networking

Mysql 8 mengubah kata sandi root
Edit file konfigurasi systemd mysql

Setelah menambahkan baris di atas, tekan

$ sudo systemctl edit mysql
_3 dan
$ sudo systemctl edit mysql
4 untuk menyimpan file dan kemudian tekan
$ sudo systemctl edit mysql
5 untuk menutupnya

Di sini, opsi

$ sudo systemctl edit mysql
_6 memungkinkan Anda terhubung ke server database MySQL tanpa kata sandi dan dengan semua hak istimewa. Ini juga akan menonaktifkan pernyataan manajemen akun seperti
$ sudo systemctl edit mysql
7 dan
$ sudo systemctl edit mysql
8. Dan opsi
$ sudo systemctl edit mysql
_9 digunakan untuk mencegah klien lain terhubung ke server database. Karena ini menonaktifkan semua koneksi jarak jauh, tidak ada klien jarak jauh yang dapat mengakses server basis data hingga Anda me-restart server basis data secara normal

3. Muat ulang

$ sudo systemctl edit mysql
_1 konfigurasi menggunakan perintah

$ sudo systemctl daemon-reload

4. Mulai layanan MySQL

$ sudo systemctl start mysql

Ini akan memulai server MySQL dengan opsi

[Service]
ExecStart=
ExecStart=/usr/sbin/mysqld --skip-grant-tables --skip-networking
_1s dan
$ sudo systemctl edit mysql
9. Anda dapat memverifikasinya dengan memeriksa status layanan MySQL

$ sudo systemctl status mysql
 ● mysql.service - MySQL Community Server
      Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
     Drop-In: /etc/systemd/system/mysql.service.d
              └─override.conf
      Active: active (running) since Mon 2021-05-31 11:39:18 UTC; 1min 23s ago
     Process: 1882 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
    Main PID: 1905 (mysqld)
      Status: "Server is operational"
       Tasks: 36 (limit: 2280)
      Memory: 331.0M
      CGroup: /system.slice/mysql.service
              └─1905 /usr/sbin/mysqld --skip-grant-tables --skip-networking
 May 31 11:39:16 ubuntu2004.localdomain systemd[1]: Starting MySQL Community Server…
 May 31 11:39:18 ubuntu2004.localdomain systemd[1]: Started MySQL Community Server.

5. Sekarang, sambungkan ke server MySQL sebagai

● mysql.service - MySQL Community Server
      Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
      Active: inactive (dead) since Mon 2021-05-31 11:01:15 UTC; 1min 15s ago
     Process: 1446 ExecStart=/usr/sbin/mysqld (code=exited, status=0/SUCCESS)
    Main PID: 1446 (code=exited, status=0/SUCCESS)
      Status: "Server shutdown complete"
 May 31 07:57:50 ubuntu2004.localdomain systemd[1]: Starting MySQL Community Server…
 May 31 07:57:51 ubuntu2004.localdomain systemd[1]: Started MySQL Community Server.
 May 31 11:01:14 ubuntu2004.localdomain systemd[1]: Stopping MySQL Community Server…
 May 31 11:01:15 ubuntu2004.localdomain systemd[1]: mysql.service: Succeeded.
 May 31 11:01:15 ubuntu2004.localdomain systemd[1]: Stopped MySQL Community Server.
1 pengguna tanpa kata sandi

$ sudo mysql -u root

Anda akan segera diarahkan ke dalam prompt shell MySQL

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 8.0.25-0ubuntu0.20.04.1 (Ubuntu)

Copyright (c) 2000, 2021, Oracle and/or its affiliates.

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> 

6. Kami masuk ke server basis data tanpa memuat tabel hibah (karena kami menggunakan opsi

$ sudo systemctl edit mysql
6). Jadi kita tidak dapat menggunakan perintah
$ sudo systemctl edit mysql
_7 yang diperlukan untuk mengatur ulang kata sandi. Untuk memuat tabel hibah, jalankan perintah berikut dari MySQL shell prompt

$ sudo systemctl status mysql
_0

7. Selanjutnya, jalankan salah satu dari perintah berikut untuk mengatur ulang kata sandi MySQL

● mysql.service - MySQL Community Server
      Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
      Active: inactive (dead) since Mon 2021-05-31 11:01:15 UTC; 1min 15s ago
     Process: 1446 ExecStart=/usr/sbin/mysqld (code=exited, status=0/SUCCESS)
    Main PID: 1446 (code=exited, status=0/SUCCESS)
      Status: "Server shutdown complete"
 May 31 07:57:50 ubuntu2004.localdomain systemd[1]: Starting MySQL Community Server…
 May 31 07:57:51 ubuntu2004.localdomain systemd[1]: Started MySQL Community Server.
 May 31 11:01:14 ubuntu2004.localdomain systemd[1]: Stopping MySQL Community Server…
 May 31 11:01:15 ubuntu2004.localdomain systemd[1]: mysql.service: Succeeded.
 May 31 11:01:15 ubuntu2004.localdomain systemd[1]: Stopped MySQL Community Server.
1

Jika Anda menggunakan plugin

● mysql.service - MySQL Community Server
      Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
      Active: inactive (dead) since Mon 2021-05-31 11:01:15 UTC; 1min 15s ago
     Process: 1446 ExecStart=/usr/sbin/mysqld (code=exited, status=0/SUCCESS)
    Main PID: 1446 (code=exited, status=0/SUCCESS)
      Status: "Server shutdown complete"
 May 31 07:57:50 ubuntu2004.localdomain systemd[1]: Starting MySQL Community Server…
 May 31 07:57:51 ubuntu2004.localdomain systemd[1]: Started MySQL Community Server.
 May 31 11:01:14 ubuntu2004.localdomain systemd[1]: Stopping MySQL Community Server…
 May 31 11:01:15 ubuntu2004.localdomain systemd[1]: mysql.service: Succeeded.
 May 31 11:01:15 ubuntu2004.localdomain systemd[1]: Stopped MySQL Community Server.
_7, jalankan

$ sudo systemctl status mysql
_1

Mysql 8 mengubah kata sandi root
Setel ulang kata sandi root di MySQL 8 di Ubuntu Linux

Jika Anda menggunakan plugin

● mysql.service - MySQL Community Server
      Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
      Active: inactive (dead) since Mon 2021-05-31 11:01:15 UTC; 1min 15s ago
     Process: 1446 ExecStart=/usr/sbin/mysqld (code=exited, status=0/SUCCESS)
    Main PID: 1446 (code=exited, status=0/SUCCESS)
      Status: "Server shutdown complete"
 May 31 07:57:50 ubuntu2004.localdomain systemd[1]: Starting MySQL Community Server…
 May 31 07:57:51 ubuntu2004.localdomain systemd[1]: Started MySQL Community Server.
 May 31 11:01:14 ubuntu2004.localdomain systemd[1]: Stopping MySQL Community Server…
 May 31 11:01:15 ubuntu2004.localdomain systemd[1]: mysql.service: Succeeded.
 May 31 11:01:15 ubuntu2004.localdomain systemd[1]: Stopped MySQL Community Server.
8, jalankan ini sebagai gantinya

$ sudo systemctl status mysql
_2

Ganti

[Service]
ExecStart=
ExecStart=/usr/sbin/mysqld --skip-grant-tables --skip-networking
_9 dengan milik Anda

Setelah mengubah kata sandi MySQL

● mysql.service - MySQL Community Server
      Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
      Active: inactive (dead) since Mon 2021-05-31 11:01:15 UTC; 1min 15s ago
     Process: 1446 ExecStart=/usr/sbin/mysqld (code=exited, status=0/SUCCESS)
    Main PID: 1446 (code=exited, status=0/SUCCESS)
      Status: "Server shutdown complete"
 May 31 07:57:50 ubuntu2004.localdomain systemd[1]: Starting MySQL Community Server…
 May 31 07:57:51 ubuntu2004.localdomain systemd[1]: Started MySQL Community Server.
 May 31 11:01:14 ubuntu2004.localdomain systemd[1]: Stopping MySQL Community Server…
 May 31 11:01:15 ubuntu2004.localdomain systemd[1]: mysql.service: Succeeded.
 May 31 11:01:15 ubuntu2004.localdomain systemd[1]: Stopped MySQL Community Server.
_1, keluar dari prompt shell MySQL

$ sudo systemctl status mysql
_3

8. Kembalikan konfigurasi

$ sudo systemctl edit mysql
_1 yang dimodifikasi kembali ke pengaturan normal menggunakan perintah

$ sudo systemctl status mysql
_4

Ini akan menghapus semua file yang dimodifikasi

$ sudo systemctl status mysql
_5

9. Muat ulang

$ sudo systemctl edit mysql
_1 konfigurasi untuk menerapkan perubahan

$ sudo systemctl daemon-reload

10. Terakhir, restart server MySQL secara normal

$ sudo systemctl status mysql
_7

11. Sekarang Anda harus dapat terhubung ke database MySQL sebagai

● mysql.service - MySQL Community Server
      Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
      Active: inactive (dead) since Mon 2021-05-31 11:01:15 UTC; 1min 15s ago
     Process: 1446 ExecStart=/usr/sbin/mysqld (code=exited, status=0/SUCCESS)
    Main PID: 1446 (code=exited, status=0/SUCCESS)
      Status: "Server shutdown complete"
 May 31 07:57:50 ubuntu2004.localdomain systemd[1]: Starting MySQL Community Server…
 May 31 07:57:51 ubuntu2004.localdomain systemd[1]: Started MySQL Community Server.
 May 31 11:01:14 ubuntu2004.localdomain systemd[1]: Stopping MySQL Community Server…
 May 31 11:01:15 ubuntu2004.localdomain systemd[1]: mysql.service: Succeeded.
 May 31 11:01:15 ubuntu2004.localdomain systemd[1]: Stopped MySQL Community Server.
1 pengguna dengan
$ sudo systemctl daemon-reload
4 menggunakan perintah

$ sudo systemctl status mysql
_8

Masukkan kata sandi

● mysql.service - MySQL Community Server
      Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
      Active: inactive (dead) since Mon 2021-05-31 11:01:15 UTC; 1min 15s ago
     Process: 1446 ExecStart=/usr/sbin/mysqld (code=exited, status=0/SUCCESS)
    Main PID: 1446 (code=exited, status=0/SUCCESS)
      Status: "Server shutdown complete"
 May 31 07:57:50 ubuntu2004.localdomain systemd[1]: Starting MySQL Community Server…
 May 31 07:57:51 ubuntu2004.localdomain systemd[1]: Started MySQL Community Server.
 May 31 11:01:14 ubuntu2004.localdomain systemd[1]: Stopping MySQL Community Server…
 May 31 11:01:15 ubuntu2004.localdomain systemd[1]: mysql.service: Succeeded.
 May 31 11:01:15 ubuntu2004.localdomain systemd[1]: Stopped MySQL Community Server.
1 untuk mengakses permintaan shell MySQL

$ sudo systemctl status mysql
_9

Ada juga cara lain untuk mengubah kata sandi MySQL

● mysql.service - MySQL Community Server
      Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
      Active: inactive (dead) since Mon 2021-05-31 11:01:15 UTC; 1min 15s ago
     Process: 1446 ExecStart=/usr/sbin/mysqld (code=exited, status=0/SUCCESS)
    Main PID: 1446 (code=exited, status=0/SUCCESS)
      Status: "Server shutdown complete"
 May 31 07:57:50 ubuntu2004.localdomain systemd[1]: Starting MySQL Community Server…
 May 31 07:57:51 ubuntu2004.localdomain systemd[1]: Started MySQL Community Server.
 May 31 11:01:14 ubuntu2004.localdomain systemd[1]: Stopping MySQL Community Server…
 May 31 11:01:15 ubuntu2004.localdomain systemd[1]: mysql.service: Succeeded.
 May 31 11:01:15 ubuntu2004.localdomain systemd[1]: Stopped MySQL Community Server.
1 di Linux. Ini sedikit berbeda dari metode ini. Jika Anda tertarik untuk mengetahuinya, lihat tautan berikut

● mysql.service - MySQL Community Server
      Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
      Active: inactive (dead) since Mon 2021-05-31 11:01:15 UTC; 1min 15s ago
     Process: 1446 ExecStart=/usr/sbin/mysqld (code=exited, status=0/SUCCESS)
    Main PID: 1446 (code=exited, status=0/SUCCESS)
      Status: "Server shutdown complete"
 May 31 07:57:50 ubuntu2004.localdomain systemd[1]: Starting MySQL Community Server…
 May 31 07:57:51 ubuntu2004.localdomain systemd[1]: Started MySQL Community Server.
 May 31 11:01:14 ubuntu2004.localdomain systemd[1]: Stopping MySQL Community Server…
 May 31 11:01:15 ubuntu2004.localdomain systemd[1]: mysql.service: Succeeded.
 May 31 11:01:15 ubuntu2004.localdomain systemd[1]: Stopped MySQL Community Server.
0

Kesimpulan

Seperti yang Anda lihat, mengatur ulang kata sandi root MySQL itu mudah. Jika Anda mengikuti langkah-langkah di atas dengan hati-hati, Anda dapat memulihkan kata sandi root database MySQL Anda dalam beberapa menit. Jangan sampai hilang lagi. Hafalkan atau simpan kata sandi Anda di tempat yang aman

Bagaimana cara mengubah kata sandi root MySQL saya?

Untuk mengubah kata sandi root, ketik berikut ini di prompt perintah MySQL/MariaDB. UBAH PENGGUNA 'root'@'localhost' DIIDENTIFIKASI OLEH 'MyN3wP4ssw0rd'; . Store the new password in a secure location.

Bagaimana cara mengatur ulang kata sandi root di MySQL 8 Linux?

Reset Kata Sandi Root MySQL Menggunakan –init-file . UBAH USER 'root'@'localhost' DIIDENTIFIKASI OLEH 'new_password'; Pada contoh di atas ubah “new_password” dengan password yang ingin Anda gunakan.

Bagaimana cara mereset kata sandi root saya di MySQL Workbench 8. 0 CE?

Langkah-langkah mereset kata sandi pengguna root. .
Buat file inisialisasi yang memiliki perintah ALTER USER
Hentikan Layanan MySQL
Mulai layanan menggunakan mysqld dan tentukan file yang memiliki perintah ALTER USER
Sambungkan ke meja kerja MySQL dan setel ulang kata sandi root
Mulai ulang layanan

Apa kata sandi untuk pengguna root di MySQL 8?

Pengguna default untuk MySQL adalah root dan secara default memiliki tanpa kata sandi .