title: Python connect to MySQL database on web server
body: <p>I wanted to know the process of connecting to a MySQL database that is hosted on a web server.</p>
  
  <p>I have a basic free webserver for testing on 000webhost on which I created a MySQL database.</p>
  
  <p>I have the credentials for the database which I will pretend are
  host     - mysql.webhost000.com
  user     - dummy_user
  password - dummy_password
  database - dummy_database</p>
  
  <p>and I have a python script executing from my local computer with internet access</p>
  
  <pre><code>import MySQLdb
  
  db = MySQLdb.connect(host="mysql.webhost000.com",
                       port=3306,
                       user="dummy_user",
                       passwd="dummy_password",
                       db="dummy_database")
  </code></pre>
  
  <p>I was hoping it would connect as long as I have the right credentials but when I execute the script it just hangs and once I quit it I see the error</p>
  
  <pre><code>Can't connect to MySQL server on 'mysql.webhost000.com' (4)
  </code></pre>
  
  <p>Am I missing some steps?</p>