Re: Security: MySql - Perl
Michael Stassen <[email protected]>
| Newsgroups | gmane.comp.db.mysql.perl |
|---|---|
| Message-ID | <[email protected]> |
Ãkos Tomasits wrote: > Hi! > > Sorry, I am a beginner with Perl. > > I try to connect to a MySQL database whith a perl script but I always > get the following error: > "DBD::mysql::st execute failed: SELECT command denied to user: > 'logger@localhost' for table 'category'..." OK, logger@localhost doesn't have permission to work with the table named category in some db. > I have granted all of the priviledges to the user logger by this mysql > console command: > GRANT ALL PRIVILEGES ON logger > TO 'logger'@'localhost' > IDENTIFIED BY 'logger'; > > GRANT ALL PRIVILEGES ON logger > TO 'logger'@'%' > IDENTIFIED BY 'logger'; These grant the logger users (@localhost and @%) all privileges on the logger table in whatever db was in use at the time. It does not grant any permissions for the category table. That's probably not what you meant. Is logger the name of the db? If you want the logger users to be able to work with all tables in the logger db, you need to GRANT ALL PRIVILEGES ON logger.* TO 'logger'@'localhost' IDENTIFIED BY 'logger_passwd'; See the manual for details on using GRANT <http://dev.mysql.com/doc/mysql/en/grant.html>. > use mysql > update user set select_priv='Y' where user="logger"; This sets a GLOBAL privilege, which you probably don't want. In any case, it won't take effect until you FLUSH PRIVILEGES or restart mysqld. Still, the solution is to get the GRANT right, not to edit the mysql table. > With the bin/mysql client I can connect and do everything on the above > database as "logger", but from the PERL script I cannot. Based on what you've shown us, I'm skeptical. If that's really true, we'll need more info. Show us the connection command you use for the mysql client, the lines of your perl code which make the connection and the select, and show us the output of SHOW GRANTS FOR logger@localhost; SHOW GRANTS FOR logger@%; > Thank you! > Akos Tomasits It would probably be a good idea for you to read about the mysql privilege system <http://dev.mysql.com/doc/mysql/en/what-privileges.html>. Michael -- MySQL Perl Mailing List For list archives: http://lists.mysql.com/perl To unsubscribe: http://lists.mysql.com/[email protected]