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

ID Topic: 38000 • Có 602 lượt xem
Hình đại diện của thành viên
#1 - @521075
03/12/2020 02:53
I - Editing the Defaults File:
- edit file: /etc/my.cnf.d/server.cnf
Mã: [mysqld]
    ...
    skip-networking
    ...
    bind-address = <some ip-address>
    ...

to
Mã: [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/
(Cốc Cốc 91.0.144)
PM|Trích|Like|Sửa|Xóa|Báo cáo|Cảnh cáo
Sửa lần cuối: nghiatichxanh1992 03/12/2020 02:53
_______________
Diễn đàn chia sẻ kiến thức máy tính:
KETNOI123.COM

Ấn hiện ra để xem chữ ký của mình:
Trả lời nhanh

Chủ đề tương tự