php - MySql PDO access denied when passing pdo object to another class -


i have 2 linux vms below configuration:

vm 1:
os: redhat enterprise linux 5.4
apache: 2.2.23
php: 5.5.3
mysql: 5.5.28
php config: './configure' '--with-apxs2=/usr/local/apache2/bin/apxs' '--prefix=/usr/local/apache2/php' '--with-config-file-path=/usr/local/apache2/php' '--disable-cgi' '--with-zlib' '--with-gettext' '--with-gdbm' '--with-sqlite3' '--enable-sqlite-utf8' '--with-mysql=/usr/local/mysql/' '--with-pdo-mysql=mysqlnd' '--enable-mbstring' '--enable-calendar' '--with-curl=/usr/lib' '--with-gd' '--with-jpeg-dir=/usr/lib/libjpeg.so' '--with-png-dir=/usr/lib/libpng.so' '--enable-soap' '--enable-bcmath'

vm 2:
os: redhat enterprise linux 6.4
apache: 2.4.6
php: 5.3.27
mysql: 5.6.13
php config: './configure' '--with-apxs2=/usr/local/apache2/bin/apxs' '--prefix=/usr/local/apache2/php' '--with-config-file-path=/usr/local/apache2/php' '--disable-cgi' '--with-zlib' '--with-gettext' '--with-gdbm' '--with-sqlite3' '--enable-sqlite-utf8' '--with-mysql=mysqlnd' '--with-pdo-mysql=mysqlnd' '--enable-mbstring' '--enable-calendar' '--with-curl=/usr/lib' '--with-gd' '--with-jpeg-dir=/usr/lib/libjpeg.so' '--with-png-dir=/usr/lib/libpng.so' '--enable-soap' '--enable-bcmath' '--with-mysqli=mysqlnd' '--with-pdo-sqlite' '--with-pear' '--enable-ftp' '--with-openssl'

i have php class connects mysql database using pdo using following code:

    try {                     $this->maindb = new pdo(pdo_mysql_host_dbname, pdo_mysql_user, pdo_mysql_password, array(pdo::attr_persistent => true));         $this->maindb->setattribute(pdo::attr_errmode, pdo::errmode_exception);                 } catch (pdoexception $e) {         die('error connecting database: ' . $e->getmessage());     } 

this part works fine, , data gets inserted database expected.

strangely towards end of class, when create object of class , pass $this->maindb object 1 of methods write more data, fails 'sqlstate[28000]: invalid authorization specification: 1045 access denied user 'team'@'localhost' (using password: yes)' error.

my problem is, same code works fine on vm1, , fails on vm2 described. have tried these options:

  • with both persistent , non-persistent connections.
  • used mysql root user privileges.

i have no idea might causing problem. please me sort out.

note: prefer solution doesn't involve downgrading packages.


Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -