Bạn đã quên mật khẩu người dùng cơ sở dữ liệu MySQL của mình
● 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? . Hướng dẫn từng bước này giải thích cách đặt lại mật khẩu gốc trong MySQL 8 trên Ubuntu 20. 04 hệ điều hànhGhi chú. Như bạn có thể đã biết, người dùng root MySQL sử dụng 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 để xác thực với máy chủ MySQL trong các hệ thống Ubuntu chạy MySQL 5. 7 và các phiên bản mới hơn. Vì vậy, bạn có thể đăng nhập vào máy chủ MySQL với tư cách là người dùng ● 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 bằng lệnh ● 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 miễn là bạn biết mật khẩu ● 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 của người dùng hệ thống. Trong trường hợp đó, không cần thiết phải thay đổi mật khẩu 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. Nếu bạn đã thay đổi phương thức xác thực cho người dùng root MySQL thành ● 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 hoặc ● 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, hãy làm theo các bước bên dưới để đặt lại mật khẩu ● 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 của cơ sở dữ liệu MySQLĐặt lại mật khẩu gốc trong MySQL 8 trên Ubuntu Linux
1. Đầu tiên, dừng dịch vụ MySQL bằng lệnh
$ sudo systemctl stop mysql
Điều này sẽ dừng dịch vụ MySQL nếu nó đang chạy. Bạn có thể xác minh trạng thái của dịch vụ MySQL bằng lệnh
● 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đầu ra mẫu
● 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. Tiếp theo, khởi động máy chủ MySQL mà không cần kiểm tra quyền. Để làm như vậy, hãy chạy
● 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.
2Thao tác này sẽ mở tệp cấu hình
● 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.
20 ● 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.
21 trình soạn thảo văn bản mặc định của bạn. Trong trường hợp của tôi, đó là biên tập viên ● 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.
22Thêm các dòng sau vào đó
● 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.
6Sau khi thêm các dòng trên, nhấn
● 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.
23 và ● 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.
24 để lưu tệp và sau đó nhấn ● 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.
25 để đóng tệpỞ đây, tùy chọn
● 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.
26 cho phép bạn kết nối với máy chủ cơ sở dữ liệu MySQL mà không cần mật khẩu và với tất cả các đặc quyền. Nó cũng sẽ vô hiệu hóa các câu lệnh quản lý tài khoản như ● 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.
27 và ● 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.
28. Và tùy chọn ● 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.
29 được sử dụng để ngăn các máy khách khác kết nối với máy chủ cơ sở dữ liệu. Vì nó vô hiệu hóa tất cả các kết nối từ xa, không máy khách từ xa nào có thể truy cập máy chủ cơ sở dữ liệu cho đến khi bạn khởi động lại máy chủ cơ sở dữ liệu bình thường3. Tải lại cấu hình
● 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.
21 bằng lệnh● 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.
54. Bắt đầu dịch vụ 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.
6Thao tác này sẽ khởi động máy chủ MySQL với các tùy chọn
● 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.
61 và ● 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.
29. Bạn có thể xác minh bằng cách kiểm tra trạng thái dịch vụ 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.
95. Bây giờ, hãy kết nối với máy chủ MySQL với tư cách là người dùng
● 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 mà không cần mật khẩu● 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.
1Bạn sẽ được hạ cánh bên trong MySQL shell prompt ngay lập tức
● 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.
26. Chúng tôi đã đăng nhập vào máy chủ cơ sở dữ liệu mà không tải các bảng cấp [vì chúng tôi đã sử dụng tùy chọn
● 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.
26]. Vì vậy, chúng tôi không thể sử dụng lệnh ● 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.
27 mà anh ấy cần để đặt lại mật khẩu. Để tải các bảng cấp, hãy chạy lệnh sau từ MySQL shell prompt● 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.
007. Tiếp theo, chạy bất kỳ lệnh nào sau đây để đặt lại mật khẩu 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.
1Nếu bạn đang sử dụng 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, hãy chạy● 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.
01Nếu bạn sử dụng 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, hãy chạy plugin này để thay thế● 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.
02Thay thế
● 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.
69 bằng của riêng bạnSau khi thay đổi mật khẩu 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, hãy thoát khỏi dấu nhắc trình bao 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.
038. Hoàn nguyên cấu hình
● 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.
21 đã sửa đổi về cài đặt bình thường bằng lệnh● 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.
04Thao tác này sẽ xóa tất cả các tệp đã sửa đổi
● 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.
059. Tải lại cấu hình
● 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.
21 để thay đổi có hiệu lực● 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.
510. Cuối cùng, khởi động lại máy chủ MySQL bình thường
● 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.
0711. Bây giờ bạn sẽ có thể kết nối với cơ sở dữ liệu MySQL với tư cách là người dùng
● 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 bằng lệnh sử dụng ● 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.
54● 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.
08Nhập mật khẩu
● 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 để truy cập MySQL shell prompt● 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.
09Ngoài ra còn có một cách khác để thay đổi mật khẩu 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 trong Linux. Nó hơi khác so với phương pháp này. Nếu bạn muốn biết, hãy xem liên kết sau● 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.
0Phần kết luận
Như bạn có thể thấy, việc đặt lại mật khẩu root của MySQL rất dễ dàng. Nếu bạn làm theo các bước trên một cách cẩn thận, bạn có thể khôi phục mật khẩu gốc cơ sở dữ liệu MySQL của mình sau vài phút. Đừng đánh mất nó một lần nữa. Ghi nhớ hoặc lưu mật khẩu của bạn ở một nơi an toàn