title: Accessing a XAMPP mysql via Python
body: <p>I'm attempting to use mysql after only having worked with sqlite in the past.</p>
  
  <p>I've installed <code>XAMPP</code> on Linux (ubuntu) and have <code>mysql</code> up and running fine (seems like that with phpMyadmin at least). However, I'm having trouble getting the MySQLdb (the python lib) working {installed this using apt}.
  to be exact:</p>
  
  <pre class="lang-py prettyprint-override"><code>
  &gt;&gt;&gt; import MySQLdb
  &gt;&gt;&gt; db = MySQLdb.connect(host="localhost",db="opfine")
  Traceback (most recent call last):
    File "&lt;input&gt;", line 1, in &lt;module&gt;
    File "/usr/lib/pymodules/python2.6/MySQLdb/__init__.py", line 81, in Connect
      return Connection(*args, **kwargs)
    File "/usr/lib/pymodules/python2.6/MySQLdb/connections.py", line 170, in __init_
    ...
      super(Connection, self).__init__(*args, **kwargs2)
  </code></pre>
  
  <blockquote>
    <p>OperationalError: (2002, "Can't connect to local MySQL server through
    socket '/var
        /run/mysqld/mysqld.sock' (2)")</p>
  </blockquote>
  
  <p>I'm guessing</p>
  
  <blockquote>
    <p>Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock</p>
  </blockquote>
  
  <p>means its expecting some sort of local installation (i.e. not within <code>XAMPP</code>), but I can't figure out how to go about modding this to get it to work with the <code>XAMMP</code> flavor of <code>mysql</code>.</p>
  
  <p>Help is much appreciated!</p>