1

When I run my script it won't connect to mysql database, I can't find my host name from godaddy I just tried mysq.mydomain.com and mydomain.com. the login details for the database are correct.

Traceback (most recent call last):
 File "mysql.py", line 6, in <module>
 conn = MySQLdb.connect(host="?",user="?",passwd="?",db="?")
 File "/usr/lib/python2.7/dist-packages/MySQLdb/__init__.py", line 81, in Connect
 return Connection(*args, **kwargs)
 File "/usr/lib/python2.7/dist-packages/MySQLdb/connections.py", line 187, in __init__
 super(Connection, self).__init__(*args, **kwargs2)
_mysql_exceptions.OperationalError: (1045, "Access denied for user 'official_autotes'@'104.156.228.189' (using password: YES)")
------------------

my code

from threading import Thread
import urllib
import re
import MySQLdb
conn = MySQLdb.connect(host="?",user="?",passwd="?",db="?")
query = "INSERT INTO tutorial (symbol) values ('AAPL')"
x = conn.cursor()
x.execute(query)
row = x.fetchal()
asked Oct 13, 2015 at 6:55
1
  • What about try to use mysql command in shell? Commented Oct 13, 2015 at 6:57

1 Answer 1

1

Grand privilage to the user and ip trying to access the MySQL table using the Python code. To do the same, execute the following commands in the mysql shell.

GRANT <privileges> ON database.* TO 'user'@'ip' IDENTIFIED BY 'password';
flush privileges;
answered Oct 13, 2015 at 7:00
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.