Upgrading from 4.1.20 to 5.0.77.... Errors
I am in the process of upgrading a server from MySQL 4.1.20 to 5.0.77, as well as upgrading PHP from 5.0.4 to 5.1.6. NOTE: Everything was running fine until the upgrade. I'm not sure if it is a PHP or MySQL issue, so perhaps someone can help.
Warning: mysqli::mysqli() [function.mysqli-mysqli]: (28000/1045): Access denied for user 'username'@'localhost' (using password: YES) in D:\httpdocs\includes\class\DBI.php on line 31
The constructor in the DBI class is (I HAVE NOT CHANGED THIS CODE, SO THE CONNECTION INFORMATION IS SOLID):
class DBI extends mysqli {
# Constructor
public function __construct($id) {
if(is_object($id)) {
return true; // do not open a new connection if already opened before
}
# set connection options
if (isset($ini['timeout'])) { // set connection timeout in seconds
parent::options(MYSQLI_OPT_CONNECT_TIMEOUT, $ini['timeout']);
}
if (isset($ini['infile'])) { // enable/disable use of LOAD LOCAL INFILE
parent::options(MYSQLI_OPT_LOCAL_INFILE, $ini['infile']);
}
if (isset($ini['command'])) { // command to execute after when connecting to MySQL server
parent::options(MYSQLI_INIT_COMMAND, $ini['command']);
}
if (isset($ini['optfile'])) { // Read options from named option file instead of my.cnf
parent::options(MYSQLI_READ_DEFAULT_FILE, $ini['optfile']);
}
if (isset($ini['group'])) { // Read options from the named group from my.cnf or the file specified with MYSQL_READ_DEFAULT_FILE.
parent::options(MYSQLI_READ_DEFAULT_GROUP, $ini['group']);
}
# connect to server
$t_host = 'host';
$t_user = 'user';
$t_pass = 'pass';
$t_db = 'db';
parent::__construct(
$t_host,
$t_user,
$t_pass,
$t_db
);
if (mysqli_connect_error()) {
//echo 'Down for Maintenance: '.mysqli_connect_error();
throw new exception("Connect exception: " . mysqli_connect_error());
}
}
Subject
Written By
Posted
Upgrading from 4.1.20 to 5.0.77.... Errors
June 21, 2011 02:09PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.