Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #100300
| Newsgroups | comp.lang.python |
|---|---|
| Date | 2015-12-11 11:13 -0800 |
| References | (1 earlier) <mailman.98.1449683869.12405.python-list@python.org> <9261e7b4-48ad-45f2-ba65-066177d21f6b@googlegroups.com> <mailman.155.1449859955.12405.python-list@python.org> <a31e76fc-6bf6-4a2c-a916-5e51980080ca@googlegroups.com> <mailman.157.1449861067.12405.python-list@python.org> |
| Message-ID | <a194e95a-cf45-4460-8fcc-2c4a9f3398a5@googlegroups.com> (permalink) |
| Subject | Re: How to connect the MYSQL database to Python program? |
| From | ICT Ezy <ictezy@gmail.com> |
On Friday, December 11, 2015 at 11:11:22 AM UTC-8, Igor Korot wrote:
> Hi,
>
> On Fri, Dec 11, 2015 at 2:00 PM, ICT Ezy <ictezy@gmail.com> wrote:
> > On Friday, December 11, 2015 at 10:52:49 AM UTC-8, Larry....@gmail.com wrote:
> >> On Fri, Dec 11, 2015 at 1:36 PM, ICT Ezy <ictezy@gmail.com> wrote:
> >> > On Wednesday, December 9, 2015 at 9:58:02 AM UTC-8, Chris Angelico wrote:
> >> >> On Thu, Dec 10, 2015 at 4:51 AM, ICT Ezy <ictezy@gmail.com> wrote:
> >> >> > Pl explain me how to connect the MYSQL database to Python program?
> >> >>
> >> >> You start by looking for a module that lets you do that. You can use
> >> >> your favourite web search engine, or go directly to PyPI.
> >> >>
> >> >> Then you learn how to use that module, including learning SQL if you
> >> >> don't already know it.
> >> >>
> >> >> ChrisA
> >> >
> >> > Now, I installed MYSQLDB and following code was done correctly.
> >> >
> >> > #!/usr/bin/python
> >> >
> >> > import MySQLdb
> >> >
> >> > # Open database connection
> >> > db = MySQLdb.connect("localhost","TESTDB")
> >>
> >> The connect should look like this:
> >>
> >> db= MySQLdb.connect(host, user, passwd, db)
> >>
> >> Or to be clearer:
> >>
> >> db= MySQLdb.connect(host="localhost", user="user", passwd="password",
> >> db="TESTDB")
> >
> > if there was error generated, i remove password and user
> >
> >>>> db= MySQLdb.connect(host="localhost", user="testuser", passwd="test123",db="TESTDB")
> >
> > Traceback (most recent call last):
> > File "<pyshell#147>", line 1, in <module>
> > db= MySQLdb.connect(host="localhost", user="testuser", passwd="test123",db="TESTDB")
> > File "C:\Python27\lib\site-packages\MySQLdb\__init__.py", line 81, in Connect
> > return Connection(*args, **kwargs)
> > File "C:\Python27\lib\site-packages\MySQLdb\connections.py", line 193, in __init__
> > super(Connection, self).__init__(*args, **kwargs2)
> > OperationalError: (1045, "Acc\xe8s refus\xe9 pour l'utilisateur: 'testuser'@'@localhost' (mot de passe: OUI)")
> >>>>
>
> Is the account testuser exist? Does it have a password "test123"?
> But more imp[ortantly - this does not have anything to do with Python.
>
> Start by trying to connect from mySQL and try to execute some
> insert/update/delete statement.
>
> Then when you succeed, start writing python code.
>
> Thank you.
>
> > pl check it
> > --
> > https://mail.python.org/mailman/listinfo/python-list
OK, I have done well now, misspelling occurred. Thanks
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
How to connect the MYSQL database to Python program? ICT Ezy <ictezy@gmail.com> - 2015-12-09 09:51 -0800
Re: How to connect the MYSQL database to Python program? Chris Angelico <rosuav@gmail.com> - 2015-12-10 04:57 +1100
Re: How to connect the MYSQL database to Python program? ICT Ezy <ictezy@gmail.com> - 2015-12-11 10:36 -0800
Re: How to connect the MYSQL database to Python program? ICT Ezy <ictezy@gmail.com> - 2015-12-11 10:39 -0800
Re: How to connect the MYSQL database to Python program? Larry Martell <larry.martell@gmail.com> - 2015-12-11 13:51 -0500
Re: How to connect the MYSQL database to Python program? ICT Ezy <ictezy@gmail.com> - 2015-12-11 11:00 -0800
Re: How to connect the MYSQL database to Python program? Igor Korot <ikorot01@gmail.com> - 2015-12-11 14:11 -0500
Re: How to connect the MYSQL database to Python program? ICT Ezy <ictezy@gmail.com> - 2015-12-11 11:13 -0800
Re: How to connect the MYSQL database to Python program? ICT Ezy <ictezy@gmail.com> - 2015-12-11 11:11 -0800
Re: How to connect the MYSQL database to Python program? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-12-09 21:42 +0000
Re: How to connect the MYSQL database to Python program? ICT Ezy <ictezy@gmail.com> - 2015-12-11 10:35 -0800
Re: How to connect the MYSQL database to Python program? ICT Ezy <ictezy@gmail.com> - 2015-12-11 10:39 -0800
csiph-web