Verfasst: Montag 16. November 2009, 12:19
Code: Alles auswählen
find / | grep my.cnf
Seit 2002 Diskussionen rund um die Programmiersprache Python
https://www.python-forum.de/
Code: Alles auswählen
find / | grep my.cnf
Code: Alles auswählen
/Library/Python/2.6/site-packages/MySQL_python-1.2.3c1-py2.6-macosx-10.6-universal.egg/MySQLdb/connections.py"
Weil die in dem *.egg File liegt.kostonstyle hat geschrieben: Und der Datei connections.py kann ich nirgends finden, warum?
Code: Alles auswählen
While I'm unsure about the original post, (some extra details like what distribution your on may help) in regards to the MacBook Pro, if your on tiger/leopard (10.4/10.5) the mysql.sock file would actually be under either /var/mysql.sock or /tmp/mysql.sock depending on wether you installed it via either source or package.
On leopard to get the mysql bindings to work you need to do the following (this worked for me):
Install Mysql (I used the x64 Intel Community Installer Package from MySQLs Dev Site)
Create a Symlink (they moved the default socket from /var to /tmp for some unknown reason)
sudo mkdir /var/mysql/
sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock
Install XCode Tools (if you haven't already as they're needed to compile the mysql bindings)
Kommt da die selbe Fehlermeldung?kostonstyle hat geschrieben:Code: Alles auswählen
DATABASE_ENGINE = 'mysql' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. DATABASE_NAME = 'example' # Or path to database file if using sqlite3. DATABASE_USER = 'webdev' # Not used with sqlite3. DATABASE_PASSWORD = 'xxxxxx' # Not used with sqlite3. DATABASE_HOST = '/tmp/mysql.sock' # Set to empty string for localhost. Not used with sqlite3. DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3.
kostonstyle hat geschrieben:das habe ich ja schon gemacht, aber das klappte auch nicht.
Edit:ice2k3 hat geschrieben:Kommt da die selbe Fehlermeldung?
Code: Alles auswählen
import MySQLdb
import sys
try:
conn = MySQLdb.connect (host = "127.0.0.1",
user = "webdev",
passwd = "xxxxxx",
db = "web")
cursor = conn.cursor()
cursor.execute ("""SELECT id, data FROM example""")
row = cursor.fetchall()
for r in row:
print(r)
cursor.close()
conn.close()
except MySQLdb.Error, e:
print "Error %d: %s" % (e.args[0], e.args[1])
sys.exit(1)