Sudo mysql_secure_installation không thể kết nối với máy chủ MySQL cục bộ thông qua ổ cắm

Theo lỗi, tôi đã cố gắng tìm tệp trong /var/lib/mysql/mysql. vớ nhưng không thể tìm thấy. Nhìn vào tôi. cnf và nhiều file khác nhưng không giải quyết được. Cuối cùng xin lưu ý rằng tôi đã không khởi động dịch vụ Mysql (MariaDB) dịch vụ.
Khi dịch vụ MariaDB được bắt đầu. Nó đã tạo mysql. sock trong var/lib/mysql/my direcoty và có thể chạy cài đặt an toàn

Example: localhost:# mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current password for the root user. If you've just installed MariaDB, and you haven't set the root password yet, the password will be blank, so you should just press enter here.

Enter current password for root (enter for none): OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB root user without the proper authorisation.

You already have a root password set, so you can safely answer 'n'.

Change the root password? [Y/n] n .. skipping.

By default, a MariaDB installation has an anonymous user, allowing anyone to log into MariaDB without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment.

Remove anonymous users? [Y/n] y .. Success!

Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y .. Success!

By default, MariaDB comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment.

Remove test database and access to it? [Y/n] y - Dropping test database... .. Success! - Removing privileges on test database... .. Success!

Reloading the privilege tables will ensure that all changes made so far will take effect immediately.

Reload privilege tables now? [Y/n] y .. Success!

Cleaning up...

All done! If you've completed all of the above steps, your MariaDB installation should now be secure.

Thanks for using MariaDB!

8 là tập lệnh shell có sẵn trên các hệ thống Unix và cho phép bạn cải thiện tính bảo mật cho bản cài đặt MariaDB của mình theo các cách sau

  • Bạn có thể đặt mật khẩu cho tài khoản root
  • Bạn có thể xóa tài khoản root có thể truy cập từ bên ngoài máy chủ lưu trữ cục bộ
  • Bạn có thể xóa tài khoản người dùng ẩn danh
  • Bạn có thể xóa cơ sở dữ liệu thử nghiệm, theo mặc định, người dùng ẩn danh có thể truy cập cơ sở dữ liệu này

Example: localhost:# mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current password for the root user. If you've just installed MariaDB, and you haven't set the root password yet, the password will be blank, so you should just press enter here.

Enter current password for root (enter for none): OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB root user without the proper authorisation.

You already have a root password set, so you can safely answer 'n'.

Change the root password? [Y/n] n .. skipping.

By default, a MariaDB installation has an anonymous user, allowing anyone to log into MariaDB without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment.

Remove anonymous users? [Y/n] y .. Success!

Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y .. Success!

By default, MariaDB comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment.

Remove test database and access to it? [Y/n] y - Dropping test database... .. Success! - Removing privileges on test database... .. Success!

Reloading the privilege tables will ensure that all changes made so far will take effect immediately.

Reload privilege tables now? [Y/n] y .. Success!

Cleaning up...

All done! If you've completed all of the above steps, your MariaDB installation should now be secure.

Thanks for using MariaDB!

8 có thể được gọi mà không cần đối số

shell> mysql_secure_installation

Tập lệnh sẽ nhắc bạn xác định những hành động cần thực hiện

Example: localhost:# mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current password for the root user. If you've just installed MariaDB, and you haven't set the root password yet, the password will be blank, so you should just press enter here.

Enter current password for root (enter for none): OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB root user without the proper authorisation.

You already have a root password set, so you can safely answer 'n'.

Change the root password? [Y/n] n .. skipping.

By default, a MariaDB installation has an anonymous user, allowing anyone to log into MariaDB without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment.

Remove anonymous users? [Y/n] y .. Success!

Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y .. Success!

By default, MariaDB comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment.

Remove test database and access to it? [Y/n] y - Dropping test database... .. Success! - Removing privileges on test database... .. Success!

Reloading the privilege tables will ensure that all changes made so far will take effect immediately.

Reload privilege tables now? [Y/n] y .. Success!

Cleaning up...

All done! If you've completed all of the above steps, your MariaDB installation should now be secure.

Thanks for using MariaDB!

Tùy chọn

Example: localhost:# mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current password for the root user. If you've just installed MariaDB, and you haven't set the root password yet, the password will be blank, so you should just press enter here.

Enter current password for root (enter for none): OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB root user without the proper authorisation.

You already have a root password set, so you can safely answer 'n'.

Change the root password? [Y/n] n .. skipping.

By default, a MariaDB installation has an anonymous user, allowing anyone to log into MariaDB without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment.

Remove anonymous users? [Y/n] y .. Success!

Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y .. Success!

By default, MariaDB comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment.

Remove test database and access to it? [Y/n] y - Dropping test database... .. Success! - Removing privileges on test database... .. Success!

Reloading the privilege tables will ensure that all changes made so far will take effect immediately.

Reload privilege tables now? [Y/n] y .. Success!

Cleaning up...

All done! If you've completed all of the above steps, your MariaDB installation should now be secure.

Thanks for using MariaDB!

8 chấp nhận một số tùy chọn

Các tùy chọn không được công nhận khác sẽ được chuyển đến máy chủ

Tệp tùy chọn

Ngoài việc đọc các tùy chọn từ dòng lệnh,

Example: localhost:# mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current password for the root user. If you've just installed MariaDB, and you haven't set the root password yet, the password will be blank, so you should just press enter here.

Enter current password for root (enter for none): OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB root user without the proper authorisation.

You already have a root password set, so you can safely answer 'n'.

Change the root password? [Y/n] n .. skipping.

By default, a MariaDB installation has an anonymous user, allowing anyone to log into MariaDB without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment.

Remove anonymous users? [Y/n] y .. Success!

Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y .. Success!

By default, MariaDB comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment.

Remove test database and access to it? [Y/n] y - Dropping test database... .. Success! - Removing privileges on test database... .. Success!

Reloading the privilege tables will ensure that all changes made so far will take effect immediately.

Reload privilege tables now? [Y/n] y .. Success!

Cleaning up...

All done! If you've completed all of the above steps, your MariaDB installation should now be secure.

Thanks for using MariaDB!

8 cũng có thể đọc các tùy chọn từ các tệp tùy chọn. Nếu một tùy chọn không xác định được cung cấp cho

Example: localhost:# mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current password for the root user. If you've just installed MariaDB, and you haven't set the root password yet, the password will be blank, so you should just press enter here.

Enter current password for root (enter for none): OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB root user without the proper authorisation.

You already have a root password set, so you can safely answer 'n'.

Change the root password? [Y/n] n .. skipping.

By default, a MariaDB installation has an anonymous user, allowing anyone to log into MariaDB without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment.

Remove anonymous users? [Y/n] y .. Success!

Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y .. Success!

By default, MariaDB comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment.

Remove test database and access to it? [Y/n] y - Dropping test database... .. Success! - Removing privileges on test database... .. Success!

Reloading the privilege tables will ensure that all changes made so far will take effect immediately.

Reload privilege tables now? [Y/n] y .. Success!

Cleaning up...

All done! If you've completed all of the above steps, your MariaDB installation should now be secure.

Thanks for using MariaDB!

8 trong tệp tùy chọn, thì tùy chọn đó sẽ bị bỏ qua

Các tùy chọn sau đây liên quan đến cách các công cụ dòng lệnh của MariaDB xử lý các tệp tùy chọn. Chúng phải được đưa ra làm đối số đầu tiên trên dòng lệnh

Nhóm tùy chọn

Example: localhost:# mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current password for the root user. If you've just installed MariaDB, and you haven't set the root password yet, the password will be blank, so you should just press enter here.

Enter current password for root (enter for none): OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB root user without the proper authorisation.

You already have a root password set, so you can safely answer 'n'.

Change the root password? [Y/n] n .. skipping.

By default, a MariaDB installation has an anonymous user, allowing anyone to log into MariaDB without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment.

Remove anonymous users? [Y/n] y .. Success!

Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y .. Success!

By default, MariaDB comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment.

Remove test database and access to it? [Y/n] y - Dropping test database... .. Success! - Removing privileges on test database... .. Success!

Reloading the privilege tables will ensure that all changes made so far will take effect immediately.

Reload privilege tables now? [Y/n] y .. Success!

Cleaning up...

All done! If you've completed all of the above steps, your MariaDB installation should now be secure.

Thanks for using MariaDB!

8 đọc các tùy chọn sau đây từ các tệp tùy chọn

Sử dụng với cụm Galera

Tập lệnh này không an toàn 100% khi sử dụng với Galera Cluster vì nó thao tác trực tiếp với mysql. người dùng/mysql. bảng global_priv, không được Galera vận chuyển đến các nút khác

Người dùng làm việc với MySQL có thể gặp lỗi 'Không thể kết nối với máy chủ MySQL cục bộ thông qua ổ cắm'/var/run/mysqld/mysqld. sock (2)' khi đăng nhập vào giao diện MySQL. Vấn đề này thường phát sinh nếu MySQL không thể truy cập mysqld. tập tin ổ cắm vớ

Trong hướng dẫn này, chúng tôi sẽ xem xét các nguyên nhân tiềm ẩn gây ra lỗi 'Không thể kết nối với máy chủ MySQL cục bộ thông qua ổ cắm' và chỉ cho bạn các phương pháp khác nhau để giải quyết vấn đề này

How to fix 'can't connect to local MySQL server through socket' error

điều kiện tiên quyết

  • Một hệ thống chạy Ubuntu 20. 04
  • Tài khoản người dùng có đặc quyền sudo
  • Truy cập vào cửa sổ đầu cuối/dòng lệnh
  • Một bản sao của MySQL đã được cài đặt và sẵn sàng để sử dụng (tìm hiểu cách cài đặt nó với hướng dẫn cài đặt MySQL trên Ubuntu 20 của chúng tôi. 04)

Giải quyết 'Không thể kết nối với máy chủ MySQL cục bộ thông qua ổ cắm'/var/run/mysqld/mysqld. vớ' (2)' Lỗi

Có nhiều cách để giải quyết lỗi 'Không thể kết nối với máy chủ MySQL cục bộ thông qua ổ cắm'/var/run/mysqld/mysqld. vớ (2)' lỗi. Nếu một giải pháp không hoạt động, hãy di chuyển xuống danh sách cho đến khi bạn tìm thấy giải pháp giải quyết vấn đề

Phương pháp 1. Kiểm tra dịch vụ MySQL

1. Kiểm tra trạng thái của dịch vụ MySQL với

sudo systemctl status mysql

Checking the status of the MySQL service

2. Nếu dịch vụ không chạy, hãy khởi động lại bằng cách sử dụng

sudo systemctl start mysql

3. Để ngăn sự cố này xảy ra, hãy đặt dịch vụ MySQL tự động khởi động khi khởi động

sudo systemctl enable mysql

Set the MySQL service to automatically start when the system boots up

Phương pháp 2. xác minh mysqld. vớ Vị trí

'Không thể kết nối với máy chủ MySQL cục bộ thông qua ổ cắm'/var/run/mysqld/mysqld. lỗi sock'(2)' cũng xảy ra nếu MySQL không thể tìm thấy mysql. tập tin ổ cắm vớ

1. Tìm mysqld hiện tại. vị trí sock bằng cách sử dụng lệnh

sudo systemctl start mysql
3 để liệt kê tất cả các tệp ổ cắm trên hệ thống của bạn

sudo find / -type s

List all the socket files on your system using the find command

2. Mở tệp cấu hình MySQL trong trình soạn thảo văn bản bạn chọn. Trong ví dụ này, chúng tôi sử dụng nano

sudo nano /etc/mysql/my.cnf

3. Sau đó, thêm các dòng sau vào cuối tệp cấu hình MySQL

________số 8

Ở đâu

  • sudo systemctl start mysql
    4. Đường dẫn đến mysqld. sock socket bạn đã tìm thấy ở Bước 1

Edit the MySQL configuration file

Một phương pháp khác là tạo một liên kết tượng trưng từ vị trí của mysqld. sock vào thư mục /var/run/mysqld

Example: localhost:# mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current password for the root user. If you've just installed MariaDB, and you haven't set the root password yet, the password will be blank, so you should just press enter here.

Enter current password for root (enter for none): OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB root user without the proper authorisation.

You already have a root password set, so you can safely answer 'n'.

Change the root password? [Y/n] n .. skipping.

By default, a MariaDB installation has an anonymous user, allowing anyone to log into MariaDB without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment.

Remove anonymous users? [Y/n] y .. Success!

Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y .. Success!

By default, MariaDB comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment.

Remove test database and access to it? [Y/n] y - Dropping test database... .. Success! - Removing privileges on test database... .. Success!

Reloading the privilege tables will ensure that all changes made so far will take effect immediately.

Reload privilege tables now? [Y/n] y .. Success!

Cleaning up...

All done! If you've completed all of the above steps, your MariaDB installation should now be secure.

Thanks for using MariaDB!

0

4. Nhấn Ctrl + X để đóng tệp cấu hình và nhập Y và nhấn Enter để lưu các thay đổi bạn đã thực hiện

4. Cuối cùng, khởi động lại dịch vụ MySQL

Example: localhost:# mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current password for the root user. If you've just installed MariaDB, and you haven't set the root password yet, the password will be blank, so you should just press enter here.

Enter current password for root (enter for none): OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB root user without the proper authorisation.

You already have a root password set, so you can safely answer 'n'.

Change the root password? [Y/n] n .. skipping.

By default, a MariaDB installation has an anonymous user, allowing anyone to log into MariaDB without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment.

Remove anonymous users? [Y/n] y .. Success!

Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y .. Success!

By default, MariaDB comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment.

Remove test database and access to it? [Y/n] y - Dropping test database... .. Success! - Removing privileges on test database... .. Success!

Reloading the privilege tables will ensure that all changes made so far will take effect immediately.

Reload privilege tables now? [Y/n] y .. Success!

Cleaning up...

All done! If you've completed all of the above steps, your MariaDB installation should now be secure.

Thanks for using MariaDB!

1

Phương pháp 3. Kiểm tra quyền thư mục MySQL

Một nguyên nhân tiềm năng khác có thể là Dịch vụ MySQL không thể truy cập thư mục /var/run/mysqld do hạn chế về quyền

1. Để giải quyết vấn đề này, hãy thay đổi cài đặt quyền cho thư mục mysqld bằng

Example: localhost:# mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current password for the root user. If you've just installed MariaDB, and you haven't set the root password yet, the password will be blank, so you should just press enter here.

Enter current password for root (enter for none): OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB root user without the proper authorisation.

You already have a root password set, so you can safely answer 'n'.

Change the root password? [Y/n] n .. skipping.

By default, a MariaDB installation has an anonymous user, allowing anyone to log into MariaDB without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment.

Remove anonymous users? [Y/n] y .. Success!

Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y .. Success!

By default, MariaDB comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment.

Remove test database and access to it? [Y/n] y - Dropping test database... .. Success! - Removing privileges on test database... .. Success!

Reloading the privilege tables will ensure that all changes made so far will take effect immediately.

Reload privilege tables now? [Y/n] y .. Success!

Cleaning up...

All done! If you've completed all of the above steps, your MariaDB installation should now be secure.

Thanks for using MariaDB!

2

Đặt quyền thành

sudo systemctl start mysql
5 cho phép người dùng root đọc, viết và thực thi thư mục, trong khi những người dùng khác chỉ có thể đọc và thực thi

2. Khởi động lại dịch vụ MySQL để các thay đổi có hiệu lực

Example: localhost:# mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current password for the root user. If you've just installed MariaDB, and you haven't set the root password yet, the password will be blank, so you should just press enter here.

Enter current password for root (enter for none): OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB root user without the proper authorisation.

You already have a root password set, so you can safely answer 'n'.

Change the root password? [Y/n] n .. skipping.

By default, a MariaDB installation has an anonymous user, allowing anyone to log into MariaDB without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment.

Remove anonymous users? [Y/n] y .. Success!

Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y .. Success!

By default, MariaDB comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment.

Remove test database and access to it? [Y/n] y - Dropping test database... .. Success! - Removing privileges on test database... .. Success!

Reloading the privilege tables will ensure that all changes made so far will take effect immediately.

Reload privilege tables now? [Y/n] y .. Success!

Cleaning up...

All done! If you've completed all of the above steps, your MariaDB installation should now be secure.

Thanks for using MariaDB!

1

Phương pháp 4. Kiểm tra nhiều phiên bản MySQL

Lỗi cũng xảy ra nếu có nhiều phiên bản MySQL chạy cùng một lúc

1. Để liệt kê tất cả các phiên bản của MySQL, hãy sử dụng

sudo systemctl start mysql
0

Listing all currently running instance of MySQL

2. Nếu có nhiều phiên bản MySQL đang chạy, hãy chấm dứt chúng bằng

sudo systemctl start mysql
1

3. Khởi động lại dịch vụ MySQL để bắt đầu một phiên bản duy nhất của MySQL

Example: localhost:# mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current password for the root user. If you've just installed MariaDB, and you haven't set the root password yet, the password will be blank, so you should just press enter here.

Enter current password for root (enter for none): OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB root user without the proper authorisation.

You already have a root password set, so you can safely answer 'n'.

Change the root password? [Y/n] n .. skipping.

By default, a MariaDB installation has an anonymous user, allowing anyone to log into MariaDB without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment.

Remove anonymous users? [Y/n] y .. Success!

Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y .. Success!

By default, MariaDB comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment.

Remove test database and access to it? [Y/n] y - Dropping test database... .. Success! - Removing privileges on test database... .. Success!

Reloading the privilege tables will ensure that all changes made so far will take effect immediately.

Reload privilege tables now? [Y/n] y .. Success!

Cleaning up...

All done! If you've completed all of the above steps, your MariaDB installation should now be secure.

Thanks for using MariaDB!

1

Phần kết luận

Sau khi đọc hướng dẫn này, bạn hẳn đã xác định được nguyên nhân gây ra lỗi 'Không thể kết nối với máy chủ MySQL cục bộ thông qua ổ cắm' và áp dụng giải pháp thích hợp