Welcome to TDBSoverflow, Our class's own StackOverflow. Our rules:
  1. Use only meaningful and self-explanatory titles
  2. Tag your questions with meaningful keywords
  3. Use upvotes and downvotes to rate the answers
  4. When you receive a satisfying answer - Click the "V" button
Remember: you may get up to 5 bonus points to your final grade!

Unable to connect using option 1

+2 votes
I opened a tunnel using Putty as we did during ex1 (i can connect sakila for example), but i'm still unable to connect using the following code:

MYSQL_USER = 'DbMysql08'
MYSQL_DB_NAME = 'DbMysql08'
MYSQL_HOST = 'localhost'



I get the following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 699, in runfile
    execfile(filename, namespace)
  File "/usr/lib/python2.7/dist-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 81, in execfile
    builtins.execfile(filename, *where)
  File "/home/matan/DataBases/Project/ConnectionTest.py", line 16, in <module>
_mysql_exceptions.OperationalError: (1045, "Access denied for user 'DbMysql08'@'localhost' (using password: YES)")


What am i doing wrong?


asked Jan 13, 2018 by matan (480 points)

1 Answer

+1 vote
Best answer

Because your'e getting an answer from some server (Access denied), and the credentials are fine, I assume by this code you reach your local my-sql server. 

Try to configure the SSH-tunnel to a port different than the default MySQL port (e.g 1234) and use the following line of code instead:


Hope this helps.

answered Jan 13, 2018 by oz (12,430 points)
selected Jan 14, 2018 by Amit
yes or just use 3305 (as the configuration for ex1)