RizwanAbasi
asked on
Configuring MySQL & then making it sure that PHP works with MySQL
Greetings to all experts,
it's very urgent.
i have a little bit problem here.I have installed PHP version 4.4.1 and it's working well. I want to connect PHP with MySQ DatabaseL(Like that ASP is connected with MS ACCESS Database). I have also installed MySQL and it installed successfully. I also configured it but it's not still working.
In order to check whether PHP is working with MySQL i checked that in PHP MyAdmin but it gives the following error.
"phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in config.inc.php and make sure that they correspond to the information given by the administrator of the MySQL server".
I still can't understand that what the problem is in connecting PHP with MySQL.
I also configured MySQL again and again but the problem didn't solve.
It's urgent so help me i shall check whether your comments solved my problem or not. The expert who will solve my problem will be given full credit as he deserves that.
it's very urgent.
i have a little bit problem here.I have installed PHP version 4.4.1 and it's working well. I want to connect PHP with MySQ DatabaseL(Like that ASP is connected with MS ACCESS Database). I have also installed MySQL and it installed successfully. I also configured it but it's not still working.
In order to check whether PHP is working with MySQL i checked that in PHP MyAdmin but it gives the following error.
"phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in config.inc.php and make sure that they correspond to the information given by the administrator of the MySQL server".
I still can't understand that what the problem is in connecting PHP with MySQL.
I also configured MySQL again and again but the problem didn't solve.
It's urgent so help me i shall check whether your comments solved my problem or not. The expert who will solve my problem will be given full credit as he deserves that.
You need
Reset the password to pre-4.1 style for each user that needs to use a pre-4.1 client program. This can be done using the SET PASSWORD statement and the OLD_PASSWORD() function:
On mysql prompt type
SET PASSWORD FOR 'some_user'@'some_host' = OLD_PASSWORD('newpwd');
Alternatively, use UPDATE and FLUSH PRIVILEGES:
UPDATE mysql.user SET Password = OLD_PASSWORD('newpwd') WHERE Host = 'some_host' AND User = 'some_user';
FLUSH PRIVILEGES;
Reset the password to pre-4.1 style for each user that needs to use a pre-4.1 client program. This can be done using the SET PASSWORD statement and the OLD_PASSWORD() function:
On mysql prompt type
SET PASSWORD FOR 'some_user'@'some_host' = OLD_PASSWORD('newpwd');
Alternatively, use UPDATE and FLUSH PRIVILEGES:
UPDATE mysql.user SET Password = OLD_PASSWORD('newpwd') WHERE Host = 'some_host' AND User = 'some_user';
FLUSH PRIVILEGES;
ASKER
wasifg,
i am currently looking to get help from the link you gave me in the second conversation.I can't get what you explained/said in first and last conversation. Be here for my latest comment.
i am currently looking to get help from the link you gave me in the second conversation.I can't get what you explained/said in first and last conversation. Be here for my latest comment.
What is your connection parameter/code?
ASKER
Wasifg,
I think that you don't got what i want to say/ask? I think that i have problems configuring MySQL. However i'm sure that MySQL is installed successfully. Fist time i configured MySQL it gave no error. But second time when i configured MySQL it gave an error while the execution.
Let me tell you what was the error.
I think that you don't got what i want to say/ask? I think that i have problems configuring MySQL. However i'm sure that MySQL is installed successfully. Fist time i configured MySQL it gave no error. But second time when i configured MySQL it gave an error while the execution.
Let me tell you what was the error.
did u change the settings in config.inc.php? You need to set the username and password for the mysql. default usernamae is root and password is null.
can you please make a basic page to connect to DB
make a .php page with this code and tell is there any error?
<?
mysql_connect("localhost", "root", "") or die("Error connection to Localhost: ".mysql_error());
?>
http://www.php.net/manual/en/function.mysql-connect.php
make a .php page with this code and tell is there any error?
<?
mysql_connect("localhost",
?>
http://www.php.net/manual/en/function.mysql-connect.php
ASKER
Actually i'm making a blog for my website.I have downloaded a PHP/MySQL blog. and that blog is not running on my localhost. giving an error which is related to MySQL database.
Now let me tell that what error was given while configuring MySQL.
(A popup error message appears while configuring)"The security settings could not be applied because the connection has failed. Access denied for 'root'@'localhost'"
keeping in mind that while configuring MySQL i gave,
user:root
pass:pass
Now let me tell that what error was given while configuring MySQL.
(A popup error message appears while configuring)"The security settings could not be applied because the connection has failed. Access denied for 'root'@'localhost'"
keeping in mind that while configuring MySQL i gave,
user:root
pass:pass
can you test a baisc connection page, see my previos post. doing so you will know what exactly the error is
Muhammad Wasif
Muhammad Wasif
ASKER
yeah, i have made changes in config.inc.php
$cfg['Servers'][$i]['user' ] = 'root';
$cfg['Servers'][$i]['passw ord'] = 'pass';
let me make that PHP page & write that code you wrote above.
$cfg['Servers'][$i]['user'
$cfg['Servers'][$i]['passw
let me make that PHP page & write that code you wrote above.
ASKER
Muhammad Wasif Sahb,
i wrote that code in a PHP file and on execution that page gave me the following error.
Warning: mysql_connect(): Client does not support authentication protocol requested by server; consider upgrading MySQL client in c:\inetpub\wwwroot\php\err or.php on line 10
Error connection to Localhost: Client does not support authentication protocol requested by server; consider upgrading MySQL client.
where line 10 is the code you wrote above.
mysql_connect("localhost", "root", "") or die("Error connection to Localhost: ".mysql_error());
i wrote that code in a PHP file and on execution that page gave me the following error.
Warning: mysql_connect(): Client does not support authentication protocol requested by server; consider upgrading MySQL client in c:\inetpub\wwwroot\php\err
Error connection to Localhost: Client does not support authentication protocol requested by server; consider upgrading MySQL client.
where line 10 is the code you wrote above.
mysql_connect("localhost",
ASKER
Muhammad Wasif,
Don't you think that there is incorrect configuration of MySQL? Because while configuration of MySQL, it gives an error and the configuration doesn't gets completed.
Don't you think that there is incorrect configuration of MySQL? Because while configuration of MySQL, it gives an error and the configuration doesn't gets completed.
this is what i told u in the first post:) now start from my first post to solve this issue
ASKER
i've tried editing with both the codes in your second posting i.e, setpassword and update password.
but didn't solve my problem. Can you tell me that how MySQL can be configured bcz i'm sure that it's problem of MySQL server bcz it gaves error while configuring.
but didn't solve my problem. Can you tell me that how MySQL can be configured bcz i'm sure that it's problem of MySQL server bcz it gaves error while configuring.
ASKER
i'm also trying to solve my problem from the links you provided.
ASKER
these can't solve my problem?
ASKER
when i used phpinfo(); funcition in php it gave me the following configuration of MySQL
MySQL Support enabled
Active Persistent Links 0
Active Links 0
Client API version 3.23.49
Directive Local Value Master Value
mysql.allow_persistent On On
mysql.connect_timeout 60 60
mysql.default_host no value no value
mysql.default_password no value no value
mysql.default_port no value no value
mysql.default_socket no value no value
mysql.default_user no value no value
mysql.max_links Unlimited Unlimited
mysql.max_persistent Unlimited Unlimited
mysql.trace_mode Off Off
MySQL Support enabled
Active Persistent Links 0
Active Links 0
Client API version 3.23.49
Directive Local Value Master Value
mysql.allow_persistent On On
mysql.connect_timeout 60 60
mysql.default_host no value no value
mysql.default_password no value no value
mysql.default_port no value no value
mysql.default_socket no value no value
mysql.default_user no value no value
mysql.max_links Unlimited Unlimited
mysql.max_persistent Unlimited Unlimited
mysql.trace_mode Off Off
>>>i'm sure that it's problem of MySQL server bcz it gaves error while configuring.
What error it gives you?
What error it gives you?
Can you post the exact syntax you used for setpassword and update password? And where did you execute these commands?
Abbasi Sb,
did you use exactly like this?
SET PASSWORD FOR 'root'@'localhost' = OLD_PASSWORD('pass');
This link http://dev.mysql.com/doc/refman/4.1/en/old-client.html starts with the following lines
MySQL 4.1 and up uses an authentication protocol based on a password hashing algorithm that is incompatible with that used by older clients. If you upgrade the server to 4.1, attempts to connect to it with an older client may fail with the following message:
shell> mysql
Client does not support authentication protocol requested
by server; consider upgrading MySQL client
And you got the same error i.e.
Warning: mysql_connect(): Client does not support authentication protocol requested by server; consider upgrading MySQL client in
There is another solution to it, use PHP 5. This will also solve your problem.
did you use exactly like this?
SET PASSWORD FOR 'root'@'localhost' = OLD_PASSWORD('pass');
This link http://dev.mysql.com/doc/refman/4.1/en/old-client.html starts with the following lines
MySQL 4.1 and up uses an authentication protocol based on a password hashing algorithm that is incompatible with that used by older clients. If you upgrade the server to 4.1, attempts to connect to it with an older client may fail with the following message:
shell> mysql
Client does not support authentication protocol requested
by server; consider upgrading MySQL client
And you got the same error i.e.
Warning: mysql_connect(): Client does not support authentication protocol requested by server; consider upgrading MySQL client in
There is another solution to it, use PHP 5. This will also solve your problem.
ASKER
Wasifgee,
(A popup error message appears while configuring)"The security settings could not be applied because the connection has failed. Access denied for 'root'@'localhost'"
in the last step while i press EXECUTE.
In the config.inc.php file i pasted the exact code you wrote me as i provided the password "pass" while configuring MySQL.
85 $cfg['Servers'][$i]['user' ] = 'root'; // MySQL user
86 $cfg['Servers'][$i]['passw ord'] = 'pass'; // MySQL password (only needed
87 // with 'config' auth_type)
88 //UPDATE mysql.user SET Password = OLD_PASSWORD('pass') WHERE Host
= 'localhost' AND User = 'root';
89 //FLUSH PRIVILEGES;
90 SET PASSWORD FOR 'root'@'localhost' = OLD_PASSWORD('pass');
I have also pasted the line numbers(85,86,87,88,89 & 90).
i've put the line 88 & 89 as comments first and tried after this i have put the line 90 as comment and used lines 88 & 89 as code.
but can't solve my problem. I have previously visited the link you provided.You must note this point in that link.
Note: In PHP, the standard mysql extension does not support the new authentication protocol in MySQL 4.1.1 and higher. This is true regardless of the PHP version being used.
May be you are true to say that use PHP 5 instead of PHP4.4.1. But i want to use PHP4.4.1 bcause this version also configures with PHP.
These types of problems are not so complicated how looks.There will be a little bit configuration to solve this problem but i can't find that.Thanks to you that you are helping me in order to solve my problem.
(A popup error message appears while configuring)"The security settings could not be applied because the connection has failed. Access denied for 'root'@'localhost'"
in the last step while i press EXECUTE.
In the config.inc.php file i pasted the exact code you wrote me as i provided the password "pass" while configuring MySQL.
85 $cfg['Servers'][$i]['user'
86 $cfg['Servers'][$i]['passw
87 // with 'config' auth_type)
88 //UPDATE mysql.user SET Password = OLD_PASSWORD('pass') WHERE Host
= 'localhost' AND User = 'root';
89 //FLUSH PRIVILEGES;
90 SET PASSWORD FOR 'root'@'localhost' = OLD_PASSWORD('pass');
I have also pasted the line numbers(85,86,87,88,89 & 90).
i've put the line 88 & 89 as comments first and tried after this i have put the line 90 as comment and used lines 88 & 89 as code.
but can't solve my problem. I have previously visited the link you provided.You must note this point in that link.
Note: In PHP, the standard mysql extension does not support the new authentication protocol in MySQL 4.1.1 and higher. This is true regardless of the PHP version being used.
May be you are true to say that use PHP 5 instead of PHP4.4.1. But i want to use PHP4.4.1 bcause this version also configures with PHP.
These types of problems are not so complicated how looks.There will be a little bit configuration to solve this problem but i can't find that.Thanks to you that you are helping me in order to solve my problem.
Go to DOS prompt and type mysql and press enter. You will see mysql prompt like "mysql>" instead of "c:\"
Now execute the following command
SET PASSWORD FOR 'root'@'localhost' = OLD_PASSWORD('pass');
Your solution will be solved. If you still face the error, use the 2nd way. execute the following commands on the mysql prompt
UPDATE mysql.user SET Password = OLD_PASSWORD('pass') WHERE Host = 'localhost' AND User = 'root';
FLUSH PRIVILEGES;
Now execute the following command
SET PASSWORD FOR 'root'@'localhost' = OLD_PASSWORD('pass');
Your solution will be solved. If you still face the error, use the 2nd way. execute the following commands on the mysql prompt
UPDATE mysql.user SET Password = OLD_PASSWORD('pass') WHERE Host = 'localhost' AND User = 'root';
FLUSH PRIVILEGES;
ASKER
Wasif Sahb,
i think such like that i'm teasing you.But this is a problem of the type that really teased me alot of. It's the third day i'm in this problem and still can't find the solution.
As you stated, i went to dos prompt of Windows XP.It was like that.
C:\Documents and Settings:\Razzi>
(Where Razzi is the windows user name).
i typed
mysql
and pressed enter it gave me an error that
"MySQL is not recognized as an internal or external command or an operable program or a batch file."
Again i went to
C:\>
and typed
mysql
it gave me the same error.
i think such like that i'm teasing you.But this is a problem of the type that really teased me alot of. It's the third day i'm in this problem and still can't find the solution.
As you stated, i went to dos prompt of Windows XP.It was like that.
C:\Documents and Settings:\Razzi>
(Where Razzi is the windows user name).
i typed
mysql
and pressed enter it gave me an error that
"MySQL is not recognized as an internal or external command or an operable program or a batch file."
Again i went to
C:\>
and typed
mysql
it gave me the same error.
go to c:\mysql\bin directory and then type mysql:-)
i m assuming you have installed MySQL in C drive.
i m assuming you have installed MySQL in C drive.
ASKER
ya MySQL is installed in C drive you are right.
i have also gone through the start menu, to the dos prompt of mysql , it demands for password i gave the password "pass" and then it terminates.
Ler me uninstall & reinstall MySQL.
i have also gone through the start menu, to the dos prompt of mysql , it demands for password i gave the password "pass" and then it terminates.
Ler me uninstall & reinstall MySQL.
ASKER
MySQL is configured correctly.
i have done as you directed in command prompt of mysql but no results??????????????????? ??????
i have done as you directed in command prompt of mysql but no results???????????????????
now again execute the basic connection page and see what it says?
ASKER
MySQL is configured correctly.
i have done as you directed in command prompt of mysql but no results??????????????????? ??????
Now i am sure that mysql is configured correclty.
but connection of mysql with PHP???
i have done as you directed in command prompt of mysql but no results???????????????????
Now i am sure that mysql is configured correclty.
but connection of mysql with PHP???
ASKER
I have again executed the basic connection page, now it gives no error but a blank page.
i think either we are nearer to the solution or we have solved the problem.
What do you think?
i think either we are nearer to the solution or we have solved the problem.
What do you think?
ASKER
Wasif Sahib Gee,
Are you there?
Are you there?
Set up phpadmin and access. You can also use a tool MysqlFront to connect to mysql located at
http://www.mysqlfront.de/
http://www.mysqlfront.de/
ASKER
i have allready downloaded phpmyadmin.
let me do that .
let me do that .
You can also use a tool MysqlFront to connect to mysql located at
http://www.mysqlfront.de/
http://www.mysqlfront.de/
ASKER
I have installed MySQL Front.
I have also installed MySQL Admin.
I have also installed MySQL Admin.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
yeah man,
i am also running PHPMyAdmin.
i am also running PHPMyAdmin.
ASKER
Wasif geeee,
All the lucks are for me. Finally i got it. Superb and wonderful. I got it and it's running successfully.
Finally the problem is solved.
You helped me alot and this was a complex problem to solve but you looks very intelligent and brilliant that you guided me in the right way. Thanks alot of.
I am grading you A because you deserves that.
Thanks once again.
All the lucks are for me. Finally i got it. Superb and wonderful. I got it and it's running successfully.
Finally the problem is solved.
You helped me alot and this was a complex problem to solve but you looks very intelligent and brilliant that you guided me in the right way. Thanks alot of.
I am grading you A because you deserves that.
Thanks once again.
Thanx Abbasi sb. But where are my points:-P
ASKER
Wasifg,
Still you haven't got points with grade A?????????? i have awarded you.
Please check it now if you haven't received then tell me i shall contact the EE Adminstration.
No worries man you deserves that.
Still you haven't got points with grade A?????????? i have awarded you.
Please check it now if you haven't received then tell me i shall contact the EE Adminstration.
No worries man you deserves that.
ASKER
hey wasifg,
did you get the points with grade A?
did you get the points with grade A?
mysql_connect( your connection parameter) or die("Connection error: ". mysql_error());
tell what error it prints