Professional Web Applications Themes

trouble with user logon continues - MySQL

The problem seems to exist only when I try to feed an SQL script to mysql from a perl script. Here are the relevant statements from the perl script: my $cmdline = "mysql --user=$uid --password=$pwd --database=alert_db < temporary_load_script_file.sql 3>&1 1>&2 2>&3"; print $cmdline; print "\n\n"; my $rv = qx/$cmdline/; Here is what the $cmdline evaluates to: mysql --user=alert_db --password=alert_db --database=alert_db < temporary_load_script_file.sql 3>&1 1>&2 2>&3 And here is the error I get: ERROR 1045 (28000) at line 6: Access denied for user 'alert_db''localhost' (using password: YES) There are two interesting things. 1) If I replace the entire contents of 'temporary_load_script_file.sql' ...

  1. #1

    Default trouble with user logon continues

    The problem seems to exist only when I try to feed an SQL script to
    mysql from a perl script.

    Here are the relevant statements from the perl script:

    my $cmdline = "mysql --user=$uid --password=$pwd --database=alert_db <
    temporary_load_script_file.sql 3>&1 1>&2 2>&3";
    print $cmdline; print "\n\n";
    my $rv = qx/$cmdline/;

    Here is what the $cmdline evaluates to:

    mysql --user=alert_db --password=alert_db --database=alert_db <
    temporary_load_script_file.sql 3>&1 1>&2 2>&3

    And here is the error I get:

    ERROR 1045 (28000) at line 6: Access denied for user
    'alert_db''localhost' (using password: YES)

    There are two interesting things. 1) If I replace the entire contents
    of 'temporary_load_script_file.sql' by a single select statement, the
    error message goes away and the script is correctly executed. 2) The
    error seems to be generated only on line 6 of the original
    temporary_load_script_file.sql file. The first few lines are simple
    DELETE statements that clear the contents of a few tables. All of the
    rest of the statements in the file are LOAD DATA INFILE statements.
    When I created the user, I gave it all of the rights listed by MySQL
    Administrator for the alert_db database. I notice, now, though, that
    MySQL Administrator does not list any rights related to loading data
    from a file (or a way to add one, if that is the source of the
    problem).

    Any ideas on why this is happening and how I can fix it?

    Thanks.

    Ted

    Ted Guest

  2. #2

    Default Re: trouble with user logon continues

    "Ted" <r.ted.byersrogers.com> wrote:
    > mysql --user=alert_db --password=alert_db --database=alert_db <
    > temporary_load_script_file.sql 3>&1 1>&2 2>&3
    >
    > And here is the error I get:
    >
    > ERROR 1045 (28000) at line 6: Access denied for user
    > 'alert_db''localhost' (using password: YES)
    This is no *logon* problem then. It's a problem with the statement
    in line 6.
    > The error seems to be generated only on line 6 of the original
    > temporary_load_script_file.sql file. The first few lines are simple
    > DELETE statements that clear the contents of a few tables. All of the
    > rest of the statements in the file are LOAD DATA INFILE statements.
    For LOAD DATA the user needs the FILE privilege. If you use
    LOAD DATA LOCAL, things are even more complicated.

    [url]http://dev.mysql.com/doc/refman/5.0/en/load-data.html[/url]


    XL
    --
    Axel Schwenke, Senior Software Developer, MySQL AB

    Online User Manual: [url]http://dev.mysql.com/doc/refman/5.0/en/[/url]
    MySQL User Forums: [url]http://forums.mysql.com/[/url]
    Axel Schwenke Guest

  3. #3

    Default Re: trouble with user logon continues

    >The problem seems to exist only when I try to feed an SQL script to
    >mysql from a perl script.
    What happens when you type in the command (with no redirection) and
    the contents of the temporary file in MANUALLY? Does the problem
    also occur? (in which case, it's NOT only when you feed a script
    from Perl).
    >Here are the relevant statements from the perl script:
    >
    >my $cmdline = "mysql --user=$uid --password=$pwd --database=alert_db <
    >temporary_load_script_file.sql 3>&1 1>&2 2>&3";
    >print $cmdline; print "\n\n";
    >my $rv = qx/$cmdline/;
    >
    >Here is what the $cmdline evaluates to:
    >
    >mysql --user=alert_db --password=alert_db --database=alert_db <
    >temporary_load_script_file.sql 3>&1 1>&2 2>&3
    >
    >And here is the error I get:
    >
    >ERROR 1045 (28000) at line 6: Access denied for user
    >'alert_db''localhost' (using password: YES)
    What is the SQL on line 6, and what privileges does it require?
    Are there SQL statements on previous lines? If so, it's not
    a login problem, it's a SQL privilege problem. What privileges
    does line 6 require that previous lines didn't?
    >There are two interesting things. 1) If I replace the entire contents
    >of 'temporary_load_script_file.sql' by a single select statement, the
    >error message goes away and the script is correctly executed. 2) The
    >error seems to be generated only on line 6 of the original
    >temporary_load_script_file.sql file. The first few lines are simple
    >DELETE statements that clear the contents of a few tables. All of the
    >rest of the statements in the file are LOAD DATA INFILE statements.
    LOAD DATA INFILE requires FILE privilege. Is the first LOAD DATA INFILE
    on line 6?
    >When I created the user, I gave it all of the rights listed by MySQL
    >Administrator for the alert_db database. I notice, now, though, that
    >MySQL Administrator does not list any rights related to loading data
    >from a file (or a way to add one, if that is the source of the
    >problem).
    FILE privilege is not a privilege *for a database*. It's global.
    >Any ideas on why this is happening and how I can fix it?
    Your user needs FILE privilege?

    Gordon L. Burditt
    Gordon Burditt Guest

  4. #4

    Default Re: trouble with user logon continues

    Thanks Axel and Gordon,

    You're right. Once I found where to set global priviledges, and gave
    the user FILE priviledges, the problem went away.

    Thanks again

    Ted

    Ted Guest

Similar Threads

  1. How to get service logon user
    By amir.miller@gmail.com in forum PERL Modules
    Replies: 1
    Last Post: February 1st, 12:11 PM
  2. Get the NT logon user?
    By les in forum ASP.NET Security
    Replies: 1
    Last Post: August 12th, 08:54 PM
  3. No user name at logon
    By Natalie in forum Windows Setup, Administration & Security
    Replies: 0
    Last Post: July 13th, 11:15 PM
  4. user logon
    By Bob in forum Windows Setup, Administration & Security
    Replies: 1
    Last Post: July 12th, 02:10 AM
  5. Trouble enabling CTRL-ALT-DEL prompt at logon
    By Mike in forum Windows Setup, Administration & Security
    Replies: 1
    Last Post: July 4th, 07:29 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139