Author Topic: (SOLVED)Python scripts, connection refused to mysql server.  (Read 6459 times)

craigdabbs

  • Guest
Hi there,
I was hoping someone could help me out with this error.  I had previously setup this software without any issues but upon installing it on another server i am faced with this odd error

Code: [Select]
python -OOu binaries_safe_threaded.py

Binaries Safe Threaded Started at 07:07:06
Traceback (most recent call last):
  File "connections.py", line 389, in cymysql.connections.Connection._connect (cymysql/connections.c:8762)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "binaries_safe_threaded.py", line 53, in <module>
    cur = connect()
  File "binaries_safe_threaded.py", line 25, in connect
    con = mdb.connect(host=conf['DB_HOST'], user=conf['DB_USER'], passwd=conf['DB_PASSWORD'], db=conf['DB_NAME'], port=int(conf['DB_PORT']), unix_socket=conf['DB_SOCKET'], charset="utf8")
  File "/usr/lib/python3.3/site-packages/cymysql/__init__.py", line 85, in Connect
    return Connection(*args, **kwargs)
  File "connections.py", line 233, in cymysql.connections.Connection.__init__ (cymysql/connections.c:4975)
  File "connections.py", line 395, in cymysql.connections.Connection._connect (cymysql/connections.c:8921)
cymysql.err.OperationalError: (2003, "Can't connect to MySQL server on 'localhost' (111)")

The php update scripts works as expected and i have the cymysql module installed also. 

Hope someone can help.

Thanks

Craig
« Last Edit: 2013-12-22, 01:29:42 pm by craigdabbs »

Offline jonnyboy

  • Epic Indexer
  • *****
  • Posts: 1046
  • Helpful: +93/-1
  • Lazzy Trucker
Re: Python scripts, connection refused to mysql server.
« Reply #1 on: 2013-12-22, 08:47:15 am »
The problem is with you www/config.php file.

Change:
Code: [Select]
define('DB_HOST', 'localhost');To:
Code: [Select]
define('DB_HOST', '127.0.0.1');

craigdabbs

  • Guest
Re: Python scripts, connection refused to mysql server.
« Reply #2 on: 2013-12-22, 01:24:35 pm »
thanks for getting back to be jonny. 

I have tried changing the localhost to 127.0.0.1 and the actual ip address of the machine with no success. 
Also when i do change it the website is unable to log in at all but successful with localhost being entered.

mysql -u nzedb -p -h localhost  -  works fine
mysql -u nzedb -p -h 127.0.0.1 - has the same refused connection.

Im thinking its a mysql config issue?
« Last Edit: 2013-12-22, 01:29:17 pm by craigdabbs »

craigdabbs

  • Guest
Re: Python scripts, connection refused to mysql server.
« Reply #3 on: 2013-12-22, 01:28:46 pm »
Ok fixed it by commenting out the skip-networking line in my.cnf

Thanks for the help jonny