Bang hộiTiền mặt: 0 Xu Trò chơiHộp quà giáng sinhChủ Nhật, 11:59:25 - 28/04/2024
Chia sẻ kiến thức sử dụng VPS (máy chủ ảo) - Server (máy chủ riêng)

Các điều hành viên: Mod, SMod, Admin

Hương dẫn cài đặt Remote MYSQL - Instructions for installing Remote MYSQL

Hương dẫn cài đặt Remote MYSQL - Instructions for installing Remote MYSQL

#1 » Gửi bài gửi bởi nghiatichxanh1992 » 03/12/2020 02:53 » @521075

I - Editing the Defaults File:
- edit file: /etc/my.cnf.d/server.cnf
Mã: Chọn tất cả
 [mysqld]
    ...
    skip-networking
    ...
    bind-address = <some ip-address>
    ...

to
Mã: Chọn tất cả
 [mysqld]
    ...
    #skip-networking
    skip-networking=0
    ...
    #bind-address = <some ip-address>
    skip-bind-address
    ...


- Restart MySQL:
systemctl restart mariadb

- You can now verify the MariaDB listening status with the following command:
netstat -ant | grep 3306

- If everything is fine, you should get the following output:
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN

- Now, the MariaDB server is setup to listen to all IP addresses.


II - Grant Access to a User from a Remote System:
- First, login to the MariaDB shell with the following command:
mysql -u root -p

CREATE USER 'root'@'12.34.56.78' IDENTIFIED BY 'password123456';
GRANT ALL ON *.* TO 'root'@'12.34.56.78';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'12.34.56.78' IDENTIFIED BY 'password123456' WITH GRANT OPTION;
FLUSH PRIVILEGES;
SELECT User,Host FROM mysql.user;


III - Port 3306 is Configured in Firewall
- One more point to consider whether the firwall is configured to allow incoming request from remote clients:
- On RHEL and CentOS 7, it may be necessary to configure the firewall to allow TCP access to MySQL from remote hosts. To do so, execute both of these commands:
firewall-cmd --add-port=3306/tcp
firewall-cmd --permanent --add-port=3306/tcp


- Test remote MYSQL on VPS 12.34.56.78:
mysql -u root -h 111.222.333.444 -p

Explore more: https://mariadb.com/kb/en/configuring-mariadb-for-remote-client-access/
Sửa lần cuối: nghiatichxanh1992 03/12/2020 02:53
nghiatichxanh1992 ✅
Hình đại diện của thành viên
Rank: ☀️2/30☀️
Cấp độ:
Tu luyện:
Like:
Online:
Bang hội: Tiếu Ngạo
Xếp hạng Bang hội: ⚡5/60⚡
Level:
Chủ đề đã tạo: 🩸4140/4140🩸
Tiền mặt:
Ngân hàng:
Nhóm:
Danh hiệu: ⚝Truyền Thuyết⚝
Giới tính:
Ngày tham gia:
Đến từ:
Thiết bị:
Số điện thoại:
(Cốc Cốc 91.0.144)


Quay về VPS - Server

 


  • Chủ đề tương tự
    Trả lời
    Xem
    Bài viết mới nhất