September 28th, 1999, 11:42 AM
I have been keeping my userID and passwords in .htaccess, .htpasswd files (apache authentication). I have just around 2,000 users registered and they need to log in to access my registered pages.
Now I have just last week installed mySQL database on my server. If I want to copy all existing users + passwords into a table in my mySQL database, how can I go about achieving this task?
Say my table's name is "userinfo" and I have just 2 fields - userID, password with userID being my PK.
September 28th, 1999, 12:13 PM
Try this syntax:
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
LOAD DATA INFILE "./.htpasswd" INTO TABLE userinfo FIELDS TERMINATED BY ':';
[This message has been edited by moderator (edited 09-28-99).]
September 28th, 1999, 12:52 PM
So if my protected directory is "test" then it'd be : Am I right? (do I need to copy .htpasswd file from my protected page into the current directory in which my sql is ?)
LOAD DATA INFILE "/home/www/test/.htpasswd" INTO TABLE userinfo FIELDS userID, passwd TERMINATED BY ':';
Does the file have to be set in a specific format or the .htpasswd format (with | delimiter is fine by itself)?