Почему-то при подключениии через DBI из PERLа в MYSQL поступает не имя пользователя указааное в строке подключения, я Linux-аккаунт из подкоторого запускалась Перловая прога - root, apache, user.
Подскажите ПЛЗ в чем дело? Вот краткое сожержание проги, лога апача и БД mysql:
Error.log: DBI->connect(host=localhost;dummy;) failed: Access denied for user: 'apache@localhost' (Using password: NO) at / var/www/cgi-bin/test.pl line 22
Program: #!/usr/bin/perl
use strict; use DBI;
print "Content-type: text/html\n\n"; print "<b>Date: ", scalar localtime, "</b><br>\n";
my $dbh=DBI->connect("DBI:mysql:host=localhost;dummy;"); $dbh->disconnect;
print "Success.";
Shell: [root@www cgi-bin]# mysql -u dummy books Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A
Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 27 to server version: 3.23.36
Type 'help;' or '\h' for help. Type '\c' to clear the buffer
mysql> select * from info; +--------------------+--------+------------+ | title | author | issue_date | +--------------------+--------+------------+ | MqSQL handbook | NULL | 2001 | | PHP handbook | NULL | 2001 | | Perl as a Nutshell | Orelly | NULL | +--------------------+--------+------------+ 3 rows in set (0.00 sec)
mysql>
From ROOT to MYSQL db: mysql> select * from user; +-----------------------+-------+------------------+-------------+-------------+ -------------+-------------+-------------+-----------+-------------+------------ ---+--------------+-----------+------------+-----------------+------------+----- -------+ | Host | User | Password | Select_priv | Insert_priv | Update_priv | Delete_priv | Create_priv | Drop_priv | Reload_priv | Shutdown_priv | Process_priv | File_priv | Grant_priv | References_priv | Index_priv | Alter_priv | +-----------------------+-------+------------------+-------------+-------------+ -------------+-------------+-------------+-----------+-------------+------------ ---+--------------+-----------+------------+-----------------+------------+----- -------+ | localhost | root | 6a896c21722a672d | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | | localhost.localdomain | root | 6a896c21722a672d | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | | localhost | | 6a896c21722a672d | N | N | N | N | N | N | N | N | N | N | N | N | N | N | | localhost.localdomain | | 6a896c21722a672d | N | N | N | N | N | N | N | N | N | N | N | N | N | N | | localhost | dummy | | N | N | N | N | N | N | N | N | N | N | N | N | N | N | +-----------------------+-------+------------------+-------------+-------------+ -------------+-------------+-------------+-----------+-------------+------------ ---+--------------+-----------+------------+-----------------+------------+----- -------+ 5 rows in set (0.00 sec)
mysql> select * from db; +-----------+---------+-------+-------------+-------------+-------------+------- ------+-------------+-----------+------------+-----------------+------------+--- ---------+ | Host | Db | User | Select_priv | Insert_priv | Update_priv | Delete_priv | Create_priv | Drop_priv | Grant_priv | References_priv | Index_priv | Alter_priv | +-----------+---------+-------+-------------+-------------+-------------+------- ------+-------------+-----------+------------+-----------------+------------+--- ---------+ | % | test | | Y | Y | Y | Y | Y | Y | N | Y | Y | Y | | % | test\_% | | Y | Y | Y | Y | Y | Y | N | Y | Y | Y | | localhost | books | dummy | Y | Y | Y | Y | Y | Y | N | N | N | N | +-----------+---------+-------+-------------+-------------+-------------+------- ------+-------------+-----------+------------+-----------------+------------+--- ---------+ 3 rows in set (0.00 sec)
mysql> select * from tables_priv; Empty set (0.00 sec)
mysql> select * from columns_priv; Empty set (0.00 sec)
mysql> select * from host; Empty set (0.00 sec)
Если запустить перловую прогу из шела (посуть даже из-под root) типа %>perl program.pl , то не экране тоже сообщение что в error.log, тока вместо user: 'apache@localhost' будет user: 'root@localhost'.
Вот такая головоломка. Помогите кто может.