title: Getting a "TypeError: an integer is required" when trying to connect to MySQL
body: <p>Total Python newb here.</p>
  
  <p>I'm following the tutorial from <a href="http://zetcode.com/db/mysqlpython/" rel="nofollow">this page</a>.  But when I run my code I get the following error in the console.</p>
  
  <pre><code>Traceback (most recent call last):
    File "/Users/tejenshrestha/Documents/ProjectAccess/access/trunk/analysis/src/json_xml/Database.py", line 37, in &lt;module&gt;
      con = MySQLdb.connect(socket, dbhost, dbuser, dbpass, dbname);
    File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/MySQLdb/__init__.py", line 81, in Connect
      return Connection(*args, **kwargs)
    File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/MySQLdb/connections.py", line 187, in __init__
      super(Connection, self).__init__(*args, **kwargs2)
  TypeError: an integer is required
  </code></pre>
  
  <p>Searching some solutions I found required that the unix_socket path to be include, which I did as you can see.</p>
  
  <p>I'm also using <strong>XAMPP</strong> and the socket path I'm using is the one specified in XAMPP's my.cnf file.  I have MySQL running and the port it is 3306.</p>
  
  <p>Please help out this noob.</p>
  
  <p>The Python code:</p>
  
  <pre><code>import MySQLdb
  import sys
  
  con = None
  dbhost = "localhost"
  port   = "3306"
  dbuser = "root"
  dbpass = "password"
  dbname = "name"
  socket = "/Applications/XAMPP/xamppfiles/var/mysql/mysql.sock"
  
  try:
      con = MySQLdb.connect(socket, dbhost, dbuser, dbpass, dbname);
      cur = con.cursor()
      cur.execute("SELECT VERSION()")
  
      data = cur.fetchone()
      print "Database version : %s " % data
  
  except MySQLdb.Error, e:
      print "Error %d: %s" % (e.args[0],e.args[1])
      sys.exit(1)
  
  finally:    
      if con:    
          con.close()
  </code></pre>