Make MySQL can be connected remotely

xiaoxiao2021-03-06  78

Author: tansf1. Authorized Grant SELECT, INSERT, DELETE, UPDATE ON MYDB. * To Tan Identified by '123456';

2. Open Port 1) Turn off the firewall ChkConfig iptables offservice iptables stop or 2) Modify / etc / sysconfig / iptables file, plus -A rh-firewall-1-input -m state --state new -m tcp -p tcp - -Dport 3306 -j ACCEPT

3. PHP code code: Test.php

$ link = mysql_connect ($ db_host, $ db_user, $ db_password) or Die ("Connection Database Failed"); $ db = mysql_select_db ($ db_name, $ link); $ query = "Insert INTO $ company_table (company) VALUES (' Tansf ') "; $ Result = mysql_query ($ query);

$ query = "Select * from $ company_table"; $ = = mysql_query ($ query); $ total = mysql_num_rows ($ result); Echo $ total;?> Access http://192.168.1.4/test.php

转载请注明原文地址:https://www.9cbs.com/read-93010.html

New Post(0)