Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/backendrulz/MySQLTunnel
A http MySQL remote tunnel
https://github.com/backendrulz/MySQLTunnel
database mysql mysql-tunnel-client php tunnel
Last synced: 15 days ago
JSON representation
A http MySQL remote tunnel
- Host: GitHub
- URL: https://github.com/backendrulz/MySQLTunnel
- Owner: backendrulz
- License: other
- Archived: true
- Created: 2012-03-07T22:40:47.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2017-05-14T20:10:27.000Z (over 7 years ago)
- Last Synced: 2024-07-31T05:26:03.311Z (3 months ago)
- Topics: database, mysql, mysql-tunnel-client, php, tunnel
- Language: PHP
- Homepage:
- Size: 13.7 KB
- Stars: 4
- Watchers: 1
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-network-stuff - **4**星
README
# MySQLTunnel #
A http MySQL remote tunnel## Local use ##
Open index.php and put your database params and tunnel.
```
include 'tunnel.class.php';$cfg = array('tunnel_url' => 'http://localhost/MySQLTunnel/remote.tunnel.php',
'db_data' => array(
'host' => 'localhost',//default is localhost
'user' => 'YOUR USER',
'pass' => 'YOUR PASS',
'db_name' => 'YOUR DATABASE',
'port' => '3306'));//default mysql port is 3306$mysql = new Mysql_tunnel_client($cfg);
```
Write a new query for the database
```
$query = 'SELECT * FROM characters WHERE level = 85 LIMIT 5';
$q = $mysql->query($query);```
## Remote Use ##
Check your ip address and add it in the list of allowed ips in remote.tunnel.php like this.
```
class Mysql_tunnel_server{
private $db, $link;
public $errors = array();
public $ips = array('127.0.0.1','2.87.9090.244'); //Add here allowed ips
````Upload remote.tunnel.php on your domain.
Insert the link of remote tunnel
```
$cfg = array('tunnel_url' => 'http://www.yourdomain.com/MySQLTunnel/remote.tunnel.php',
```
Have fun!## Security ##
Databases credential are transmitted via http.
Only if you are on the list of allowed ips you can fetch the query.## Mysql_tunnel_client class ##
To use **mysqltunnel**, first we need to include the **Mysql_tunnel_client** class file, create an array with the **database** params and then assign the class to a new variable.
The **$cfg** array consists of the following data:- **tunnel_url**: the url of the remote tunnel.php file
- **db_data**
- **host**: the host of mysql in the remote machine (default is localhost)
- **user**: username of remote mysql
- **pass**: password of remote mysql
- **db_name**: the database name to use
- **port**: port to connect to mysql database default is 3306