Re: Unable to prepare statement with underscore
Patrik Jansson <[email protected]>
| Newsgroups | gmane.comp.db.mysql.perl |
|---|---|
| Message-ID | <[email protected]> |
Thanks for taking the time. The script did lots of other stuff to so I have rewritten a new simplier script which does only this thing. Of course I have tried to run the script and it gives the same result. This is the result: # perl grant.pl 3.0002_1 DO: Something wrong while try to prepare query This command is not supported in the prepared statement protocol yet GRANT ALL PRIVILEGES ON user_abcd.* TO 'user_abcd'@'192.168.2.1' IDENTIFIED BY 'secret' -Patrik Kenny Scott skrev: > Patrik Jansson wrote: >> >> >>> It works for me using MySQL 5.0.24, libdbd 3.0007. What >> >>> versions are you using? >> >>> >> >> Well, this particular server is running MySQL 4.1.14. How can I >> >> see which libdbd version it is? I need this script to run on >> >> different machines, on with a MySQL server as old as 4.0.14. >> > >> > Hi, >> > >> > I just ran the same thing on MySQL 4.1.11 and again, it worked. >> > >> > From your script you can get the version of the library by doing >> > this: >> > >> > print $DBD::mysql::VERSION, "\n"; >> Thanks for your help, libdbd seems to be 3.0002_1 > > Hi, > > That's the same version I ran it with, on MySQL 4.1.11. Something is > amiss here... Can you re-send the Perl script that you are running as > an attachment? I can't understand how we're getting different results > if we are running the same thing. > >> I try to update by running cpan install DBD::mysql but it fails on >> the test because it is not able to login as root, duh! How can I >> change username / password? > > Absolutely no idea, I'm afraid, but I don't think you need to update > the library at the moment as I don't think that's the problem. > -- MySQL Perl Mailing List For list archives: http://lists.mysql.com/perl To unsubscribe: http://lists.mysql.com/[email protected]
grant.pl
(text/plain, 348 B)
#!/usr/local/bin/perl -w use strict; use DBI; my $dsn = "DBI:mysql:database=mysql:host=localhost"; my $dbh = DBI->connect($dsn, "username", "password"); print $DBD::mysql::VERSION, "\n"; my $query = "GRANT ALL PRIVILEGES ON user\_abcd.* TO 'user_abcd'\@'192.168.2.1' IDENTIFIED BY 'secret'"; print $query; $dbh->do($query); $dbh->disconnect();