(no subject)
Mar. 9th, 2016 07:32 pmAstonishingly, for the first time ever I am writing CGI scripts for web pages that will be accessible from off-campus. (Catching up on those mid-1990's technical skills...) Of course I am using mysql for all server-side data handling, so each script starts off with:
$dbh = DBI->connect("dbi:mysql:SleepCog:localhost", 'cgi', 'MyFavoritePassword') ||
die "cannot open database: $!";
Um. See the 3rd argument in the call to DBI->connect()? That's the database password for the database user named cgi. This seems wrong, somehow, to have a password hard-coded into scripts, but offhand I'm not seeing other options. What's the right way to do this?
$dbh = DBI->connect("dbi:mysql:SleepCog:localhost", 'cgi', 'MyFavoritePassword') ||
die "cannot open database: $!";
Um. See the 3rd argument in the call to DBI->connect()? That's the database password for the database user named cgi. This seems wrong, somehow, to have a password hard-coded into scripts, but offhand I'm not seeing other options. What's the right way to do this?
no subject
Date: 2016-03-10 01:04 am (UTC)no subject
Date: 2016-03-10 03:38 pm (UTC)no subject
Date: 2016-03-10 05:37 pm (UTC)I don't recognize that language so can't point to an example.
no subject
Date: 2016-03-14 02:43 am (UTC)An environment variable might be more convenient, but beware that environment variables can be displayed by ps, so they're not secure relative to other processes on the same system.