Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #56751

Re: Error connecting to MySQL from Python

Newsgroups comp.lang.python
Date 2013-10-12 10:18 -0700
References <037a0c6b-1917-45dd-98cc-f1ad9aa5ef54@googlegroups.com> <qoteh7qighy.fsf@ruuvi.it.helsinki.fi>
Message-ID <987b9b5e-b79a-437c-9c65-e2182a7550ff@googlegroups.com> (permalink)
Subject Re: Error connecting to MySQL from Python
From Carlos Ortiz <carlos.ortiz.asm@gmail.com>

Show all headers | View raw


On Saturday, October 12, 2013 11:46:49 AM UTC-5, Jussi Piitulainen wrote:
> carlos.o...@gmail.com writes:
> 
> 
> 
> > So I wrote my method like this:
> 
> ...
> 
> >       cnxOMC = mysql.connector.connect(user,
> 
> >                                        password,
> 
> >                                        'localhost',
> 
> >                                        database)
> 
> ...
> 
> > the following code executes nice and smooth:
> 
> ...
> 
> >       cnxOMC = mysql.connector.connect(user="root",
> 
> >                                        password='PK17LP12r',
> 
> >                                        host='localhost',
> 
> >                                        database='TESTERS')
> 
> 
> 
> You pass the hardcoded parameters as keyword arguments, unlike in the
> 
> version that doesn't work. Maybe that is the difference. Try this:
> 
> 
> 
>        cnxOMC = mysql.connector.connect(user=user,
> 
>                                         password=password,
> 
>                                         host='localhost',
> 
>                                         database=database)
> 
> 
> 
> It only looks funny. In "user=user" the first "user" is a parameter
> 
> name, the other is the variable in your code.
> 
> 
> 
> Try help(mysql.connector.connect) at the interactive prompt, or
> 
> otherwise check the documentation.

Thanks a lot man, it worked flawlessly.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Error connecting to MySQL from Python carlos.ortiz.asm@gmail.com - 2013-10-12 09:09 -0700
  Re: Error connecting to MySQL from Python Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2013-10-12 19:46 +0300
    Re: Error connecting to MySQL from Python Carlos Ortiz <carlos.ortiz.asm@gmail.com> - 2013-10-12 10:18 -0700
  Re: Error connecting to MySQL from Python MRAB <python@mrabarnett.plus.com> - 2013-10-12 18:13 +0100
    Re: Error connecting to MySQL from Python Carlos Ortiz <carlos.ortiz.asm@gmail.com> - 2013-10-12 10:21 -0700

csiph-web