title: How to receive data from mysql using socket module in python
body: <p>How to receive data from mysql using socket module in python, i have try to import socket and connect it to mysql server for test, but have no data received from it, my code like this</p>
  
  <pre><code>def sender(data):
      sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
      host = '127.0.0.1'
      port = 3306
  
      sock.connect((host, int(port)))
      sock.sendall(data)
      sock.close()
  
  def forward():
     host = '127.0.0.1'
     port = 9999
     s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
     s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) 
     s.bind((host, int(port)))
     s.listen(10)
     sc, sockname = s.accept()
     data = sc.recv(8092)
     sender(data)
  </code></pre>
  
  <p>my destination is to forward data from my server to MySQL Server, how to correct this or anyone how to make it better, thank's</p>