name 'localhost' is not defined aber root@localhost ?
Verfasst: Mittwoch 8. Januar 2014, 00:34
Hallo Leute,
versuche mal eben schnell mit mySQL in Python klarzukommen.
Das gebe ich in Python ein.
import MySQLdb
Läuft auch. Dann das hier:
connection = MySQLdb.connect(localhost, root, passwort, datenbank)
Und es kommt die Antwort.
NameError: name 'localhost' is not defined
Was mich halt wundert denn der User von mySQL ist root@localhost
Natürlich ist die Datenbank schon angelegt, läuft alles auf einem Debian Wheezy.
Und Danke für eure Hilfe, kenne mySQL nur einem einem LAMP Server und mach normaler weise maximal was mit PHPmyAdmin.
Gruss,
sinni
versuche mal eben schnell mit mySQL in Python klarzukommen.

Das gebe ich in Python ein.
import MySQLdb
Läuft auch. Dann das hier:
connection = MySQLdb.connect(localhost, root, passwort, datenbank)
Und es kommt die Antwort.
NameError: name 'localhost' is not defined
Was mich halt wundert denn der User von mySQL ist root@localhost
Natürlich ist die Datenbank schon angelegt, läuft alles auf einem Debian Wheezy.
Und Danke für eure Hilfe, kenne mySQL nur einem einem LAMP Server und mach normaler weise maximal was mit PHPmyAdmin.
Gruss,
sinni