Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #62042
| Date | 2013-12-16 12:16 +0100 |
|---|---|
| From | Ervin Hegedüs <airween@gmail.com> |
| Subject | Re: Python, mySQL and password |
| References | <CA+FnnTz2pmBHQ7OsK5jAnZiovGeUYni_kne_F4QbWEainScStw@mail.gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.4200.1387192608.18130.python-list@python.org> (permalink) |
Hello,
On Mon, Dec 16, 2013 at 02:55:29AM -0800, Igor Korot wrote:
> Hi, ALL,
> Is there a way to make python script that connects to mySQL DB ask for
> a password on the:
>
> conn = mdb.connect(host, user)
>
> line.
> The host variable is "localhost" and the user variable is "root" (for
> developmental purposes).
may be you think some like this:
import MySQLdb
dsn = {
'host': "127.0.0.1",
'user': "root",
'passwd': "",
'port': 3306,
'db': "test"
}
dsn['passwd'] = raw_input("Enter password for %s: " % (dsn['user']))
mysql = MySQLdb.connect(**dsn)
cursor = mysql.cursor(MySQLdb.cursors.DictCursor)
but at this way the password what you type will showing!
a.
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Python, mySQL and password Ervin Hegedüs <airween@gmail.com> - 2013-12-16 12:16 +0100
csiph-web