Gossamer Forum
Home : Products : Others : MySQLMan :

Does MySQLMan work for multiple users?

Quote Reply
Does MySQLMan work for multiple users?
I don't see any mention of using the program to allow multiple people to access a single database, but their login only works for specific tables contained therein. An example of what I am talking about is phpMyAdmin's nearly un-documented option described here:

http://articles.areontheweb.com/phpMyAdmin/

I've been having a hard time getting text file imports to work in phpMyAdmin (if I'm using it to allow multiple users, I can't exactly give them telnet and ftp access for uploading/importing files) -- I think it might be due to PHP Safe Mode restrictions, but I'm not quite sure. I figure MySQLMan, being Perl based, might get around such problems...

Thanks,
Dan

edit: On closer inspection, it appears the "Central Copy" option for phpMyAdmin only works for root access privileges with the ability to create databases. I have 6 databases to work with, but that is more limiting than I had hoped...
Quote Reply
Re: Does MySQLMan work for multiple users? In reply to
Somewhat related question: The only built-in way I see to specify which database is viewed upon login (as opposed to all databases on the server, including those you don't have access to) is to run it in demo mode. However, that disables features such as import. Is there a similar variable that specifies a database(s) to list?

Furthermore, when trying to import a local tab delimited text file in non-demo mode, I don't get any errors but all the fields are imported as NULL. The auto-increment field, which actually is left blank (just a tab) in the text file, gets data filled in correctly, but nothing else is imported. The correct number of lines are there in the table, so its doing something right.

Also, the file is the exact same one I have imported into the exact same table that this one is a copy of, only in a different database, through telnet/mysqlimport, so I don't believe the problem resides in the file or the table.

Anyone had this problem?

Thanks,
Dan

Quote Reply
Re: Does MySQLMan work for multiple users? In reply to
Well, I did come up with a workaround to showing all databases by following the demo example. I set demo_mode to off (0) in mysql.cfg but kept the user/host/db settings in for it, and made the following change in sub show_dbs in mysql.cgi:

Code:
else{ # display all databases and links to drop database command.
if ($db eq $config{'demo_db'}) {
$database_list = qq~<a href="$config{'script_url'}?do=tables&data_source=DBI:mysql:$db">$db</a>\n~;
$drop_cmd = qq~<a href="$config{'script_url'}?do=database&data_source=DBI:mysql:$db&action=drop_db&db=$db">Drop</a>\n~;
$db_table_rows .= qq~<TR><TD>$database_list</TD><TD>$drop_cmd</TD></TR>~;
}
# $database_list = qq~<a href="$config{'script_url'}?do=tables&data_source=DBI:mysql:$db">$db</a>\n~;
# $drop_cmd = qq~<a href="$config{'script_url'}?do=database&data_source=DBI:mysql:$db&action=drop_db&db=$db">Drop</a>\n~;
# $db_table_rows .= qq~<TR><TD>$database_list</TD><TD>$drop_cmd</TD></TR>~;
}
That logs directly into the database set in demo_db. I haven't tried getting it to work with multiple specified databases in this method, but it looks like it ought to be doable.

I still haven't managed to get the text file upload/import working...

Dan

Quote Reply
Re: Does MySQLMan work for multiple users? In reply to
Progress!

It turned out to be easy to add multiple, specified databases, as described above. No need to enter separate passwords and hostnames for each one, just name them demo_db_2, demo_db_3, etc., and change the check in mysql.cgi to || ($db eq $config{'demo_db_2'}) || ...

I found that by converting the tab delimited file to pipe delimited, it uploads and imports just fine. I don't see why it isn't working with tab delimited. Is \t not the correct "tab" identifier for the Fields Delimiter? I don't see any mention of that in the documentation.

Dan

Quote Reply
Re: Does MySQLMan work for multiple users? In reply to
As long as I'm talking to myself... Copying an actual tab into the Fields: Delimiter: text box gets it to import tab delimited text files. Of course, you can't put in a tab through normal methods, or it simply moves the input prompt to the next text box...

This isn't the intended behavior, is it? Is there a reason why \t doesn't work?

Dan

Quote Reply
Re: Does MySQLMan work for multiple users? In reply to
Stubbornly trying to figure this out... Can anyone explain what the following does in sub import_record of mysql.cgi:

Code:
$file_q = $dbh->quote($file);
$delimiter_q = $dbh->quote($delimiter);
$rec_del_q = "'" . $rec_del . "'";
$escape_char_q = $dbh->quote($escape_char);
I assume it is for quoting input before assembling the SQL query, but I don't follow exactly what it is doing. Based on the MySQL documentation, all four of the variables should be quoted in the same manner (single quotes), yet $rec_del_q is the only one doing so in obvious fashion. Is "quote" a function of some sort? I can't find it anywhere in the files.

The reason I ask is related to trying to figure out the tab delimiter character. Different documentation sources list it as:

\t
t
'\t'
't'
"\t"
"t"

but I haven't managed to get any of those to work, so I'm thinking there is something internal tripping it up. Removing the Fields and Records Delimiter values at least gets it to recognize data as being in the tab delimited fields, but it is unable to import them correctly.

I'll keep experimenting, I just don't want to bugger up any internals too badly... At least it's only a test database. Smile

Dan


Quote Reply
Re: Does MySQLMan work for multiple users? In reply to
Call off the cavalry! I got it working. I replaced:

$delimiter_q = $dbh->quote($delimiter);

with:

$delimiter_q = "'" . $delimiter . "'";

And it now imports tab delimited files (using \t) just fine. I tried doing the same for $escape_char_q, but that threw SQL errors.

Any reason not to do this?

Dan