I do not think you need to supply host. Also, for the backslashes to be interpreted correctly, you should use a raw string, i.e.:
db = MySQLdb.connect(user="root", passwd="", db="ReportsMgmtDb",named_pipe=r"C:\Program Files\Global 360\Reports Manager Server\bin\coldsqld.sock")
Note the letter 'r' in front of your string. This is a signal to the Python parser that the following string is a raw string, which means that backslash has no special meaning.
Also, I recommend using the read_default_file option. You can point this at a file containing:
[ReportsMgmt]
user = root
password =
db = ReportsMgmtDb
protocol = PIPE
socket = C:\Program Files\Global 360\Reports Manager Server\bin\coldsqld.sock
and reduce your connect() call to:
db = MySQLdb.connect(read_default_file="my_app.cnf", read_default_group="ReportsMgmt")
Be aware that I do no MySQL work in Windows, so this is all guesswork on my part.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
mysql.exe --socket="C:\Program Files\Global 360\Reports Manager Server\bin\colds
qld.sock" --protocol=pipe
I can call mysql.exe to connect with mysql correctly.
how can I connect with mysql with mysqldb
Dear
I connect mysql ok with your recommended method.
I write a file as my_app.cnf.
thanks.
Use the named_pipe option to connect():
http://sourceforge.net/docman/display_doc.php?docid=26238&group_id=22307
Dear ajustman
how can I invoke the connect function
do I invoke connect as flowed conrrectly ?
db = MySQLdb.connect(host="localhost", user="root", passwd="", db="ReportsMgmtDb",named_pipe="C:\Program Files\Global 360\Reports Manager Server\bin\colds
qld.sock")
or
how can I get the pipe of mysql in windows ?
I do not think you need to supply host. Also, for the backslashes to be interpreted correctly, you should use a raw string, i.e.:
db = MySQLdb.connect(user="root", passwd="", db="ReportsMgmtDb",named_pipe=r"C:\Program Files\Global 360\Reports Manager Server\bin\coldsqld.sock")
Note the letter 'r' in front of your string. This is a signal to the Python parser that the following string is a raw string, which means that backslash has no special meaning.
Also, I recommend using the read_default_file option. You can point this at a file containing:
[ReportsMgmt]
user = root
password =
db = ReportsMgmtDb
protocol = PIPE
socket = C:\Program Files\Global 360\Reports Manager Server\bin\coldsqld.sock
and reduce your connect() call to:
db = MySQLdb.connect(read_default_file="my_app.cnf", read_default_group="ReportsMgmt")
Be aware that I do no MySQL work in Windows, so this is all guesswork on my part.