Note that there are some explanatory texts on larger screens.

plurals
  1. POMySQL-python not executing in CGI
    primarykey
    data
    text
    <p>I am working with MySQL-python package. I am able to execute MySQL dependent scripts from command line, however doing the same through browser (Apache CGI) yields the following error:</p> <pre><code>A problem occurred in a Python script. Here is the sequence of function calls leading up to the error, in the order they occurred. /var/www/html/temp.py in () 9 10 # Establich a connection 11 db = MySQLdb.connection(host="127.0.0.1", user="root", passwd="", db="inserv") 12 13 # Run a MySQL query from Python and get the result set db undefined, MySQLdb = &lt;module 'MySQLdb' from '/usr/lib64/python2.6/site-packages /MySQLdb/__init__.pyc'&gt;, MySQLdb.connection = &lt;type '_mysql.connection'&gt;, host undefined, user undefined, passwd undefined &lt;class '_mysql_exceptions.OperationalError'&gt;: (2003, "Can't connect to MySQL server on '127.0.0.1' (13)") args = (2003, "Can't connect to MySQL server on '127.0.0.1' (13)") message = '' </code></pre> <p>I have been stuck in this situation for past few days. MySQL commands issued through php based sites execute appropriately and I can, also, login to MySQL from command line. The problem seem to be with Python CGI only.</p> <p>I have also tried the same with oursql package and there seems to be a similar problem. How can I address this situation?</p> <p><strong>Edit</strong><br> As per @Real's answer I have edited my code to use <code>MySQLdb.connect()</code> but the problem still persist and traceback ends with:</p> <pre><code>2003, "Can't connect to MySQL server on '127.0.0.1' (13)" </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload