Seite 3 von 3

Verfasst: Donnerstag 19. November 2009, 13:15
von kostonstyle
Habe im Netz folgendes gefunden, werde diese mal versuchen

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)

Verfasst: Donnerstag 19. November 2009, 13:18
von ms4py
Laut http://code.djangoproject.com/ticket/1481 kannst du den Socket auch unter Host angeben genau wie da:
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.
Kommt da die selbe Fehlermeldung?

Verfasst: Donnerstag 19. November 2009, 13:19
von kostonstyle
das habe ich ja schon gemacht, aber das klappte auch nicht.

Verfasst: Donnerstag 19. November 2009, 13:35
von ms4py
kostonstyle hat geschrieben:das habe ich ja schon gemacht, aber das klappte auch nicht.
ice2k3 hat geschrieben:Kommt da die selbe Fehlermeldung?
Edit:

Noch eine Idee

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) 
Funktioniert das auch? (Will damit feststellen, ob dein MySQL überhaupt TCP-Verbindungen aktzeptiert)

Verfasst: Donnerstag 19. November 2009, 13:42
von ms4py

Verfasst: Samstag 21. November 2009, 21:02
von kostonstyle
nun funktioniert es einwandfrei, die Einstellungen waren richtig nur habe ich die falschen Daten genommen.
Vielen Dank für eure Mühe und Verständis.