Showing posts with label PHP. Show all posts
Showing posts with label PHP. Show all posts
Tuesday, July 24, 2012
PHP 4 can not connect to mysql server with error "Client does not support authentication protocol"
MySQL 4.1+ uses an authentication protocol based on a password hashing algorithm that is incompatible with that used by older (pre-4.1) clients. MySQL extension for PHP4 was compiled with old (pre-4.1) client library.
When you connect to server. It will shows error
"Client does not support authentication protocol requested by server; consider upgrading MySQL client"
To solve this problem, you should use one of the following approaches:
1. reset password to old style password
SET PASSWORD FOR 'some_user'@'some_host' = OLD_PASSWORD('newpwd');
For PHP mysql_connect command, you must specify parameters following
mysql_connect($server,$user,$pass,false,0);
2.Tell the server to use the older password hashing algorithm:
add this line to mysql configuration (my.ini/my.cnf)
[mysqld]
.
.
old-passwords = 1
.
.
[client]
.
.
old-passwords = 1
.
.
then restart service and reset password using command
SET PASSWORD FOR 'some_user'@'some_host' = PASSWORD('newpwd');
MySQL native driver for PHP can not connect to mysql. It shows error "mysqlnd cannot connect to MySQL 4.1+ using old authentication"
Symptom
MySQL native driver for PHP can not connect to mysql. It shows error "mysqlnd cannot connect to MySQL 4.1+ using old authentication"
Cause
New version of MySQL native driver for PHP uses an authentication protocol based on improved password hashing algorithm that is incompatible with an account that still has a pre-4.1-style password.
Solution
Reset the password to 4.1+ style for each user that needs to use the client program.
SET SESSION OLD_PASSWORDS = FALSE;
USE mysql;
UPDATE user SET password = PASSWORD('newpass') WHERE user='someuser';
FLUSH PRIVILEGES;
MySQL native driver for PHP can not connect to mysql. It shows error "mysqlnd cannot connect to MySQL 4.1+ using old authentication"
Cause
New version of MySQL native driver for PHP uses an authentication protocol based on improved password hashing algorithm that is incompatible with an account that still has a pre-4.1-style password.
Solution
Reset the password to 4.1+ style for each user that needs to use the client program.
SET SESSION OLD_PASSWORDS = FALSE;
USE mysql;
UPDATE user SET password = PASSWORD('newpass') WHERE user='someuser';
FLUSH PRIVILEGES;
Saturday, February 4, 2012
Clean up cache and log for magento
Create cleanup.php file in document root folder then put these code to it, edit database variables, save and run cleanup.php?clean=log or cleanup.php?clean=var
<?
$db['host'] = ''; // Database hostname
$db['name'] = ''; // Database name
$db['user'] = ''; // Database username
$db['pass'] = ''; // Database password
$db['pref'] = ''; // Database tables' prefix
if($_GET['clean'] == 'log') clean_log_tables();
if($_GET['clean'] == 'var') clean_var_directory();
function clean_log_tables() {
global $db;
$tables = array(
'log_url',
'log_url_info',
'log_visitor',
'log_visitor_info'
);
mysql_connect($db['host'], $db['user'], $db['pass']) or die(mysql_error());
mysql_select_db($db['name']) or die(mysql_error());
foreach($tables as $v => $k) {
mysql_query('TRUNCATE `'.$db['pref'].$k.'`') or die(mysql_error());
}
}
function clean_var_directory() {
$dirs = array(
'var/cache/',
'var/log/',
'var/report/',
'var/session/',
'var/tmp/',
'downloader/pearlib/cache/*',
'downloader/pearlib/download/*'
);
foreach($dirs as $v => $k) {
exec('rm -rf '.$k);
}
}
?>
Reference: http://www.magentocommerce.com/boards/viewthread/36148/#t117754
Monday, December 21, 2009
PEAR on Windows reports "Invalid configuration directive"
After running go-pear.bat to configure PEAR on a Windows Server you may encounter the PHP error dialog "Invalid configuration directive". To correct the issue, modify the file C:\Program Files (x86)\PHP\pear.bat. Scroll down to the :RUN section and modify the line with the PHP directive "-d include_path":
Prepend ".;" before "%PHP_PEAR_INSTALL_DIR%", and do not include the quotes. The section of line will read:
Save the file and re-run the "pear" command.
Reference: http://kb.rackforce.com/?View=entry&EntryID=97
Prepend ".;" before "%PHP_PEAR_INSTALL_DIR%", and do not include the quotes. The section of line will read:
"... -d include_path=".;%PHP_PEAR_INSTALL_DIR%" -f "%PHP_PEA..."
Save the file and re-run the "pear" command.
Reference: http://kb.rackforce.com/?View=entry&EntryID=97
Subscribe to:
Posts (Atom)