09/10/2018, 22:54

không connect được với Mysql????

Mysql server của tớ là version 4.1.
Tớ cài PHP 5.0.2
test phpinfo chạy vẫn tít.
Thử connect trong Command Window : mysql>mysql -u root -pmypassword, vẫn connect vô tư
thế mà thử connect đến database thì không được , báo lỗi như sau:
"warning : mysql_connect(): Client does not suport authentication protocol requested by server, consider upgrading MySQL client in c:inetpubwwwroot estphp.php online 2
khong ket noi duoc"
code la :
<?
mysql_connect("localhost", "root", "mypassword")
or die("khong ket noi duoc");
print("ket noi thanh cong");
?>

Vậy xin các bạn giúp tớ lỗi này . Thanks

p/s: muốn user của admin không phải là "root" thì thì làm thê nào ??
Thanks, mong hồi âm.
nguyenthu viết 01:09 ngày 10/10/2018
Thì nó có nói là Version client của bạn không chịu check UID và password, vậy bạn hãy upgrade lên đi !
Tôi có cho chạy thử, vẫn chạy ngon lành dù dưới DOS hay là với Internet Explorer, với connection có UID="autreUI", pw="".
a4hd viết 01:09 ngày 10/10/2018
Khi kết nối với MySQL ở localhost (Máy tính cá nhân của bạn) thì user bao giờ cũng là root còn password để trống là được. Khi cài MySQL lúc hỏi password thì bạn để trống. Thực ra tôi cũng mắc lỗi này và đã giải quyết như thế. Có gì Reply lại cái nhé
nguyenhaanh_us viết 00:57 ngày 10/10/2018
Không phải vậy đâu tôi cũng đang gặp phải vấn đề như thế không phải là tại username và pass đâu, tôi đã đọc help rồi nó giải thích và nói cần một số DLL vì PHP 5.x không tự động cấu hình cho mysql tôi config theo nó nhưng vì mới học PHP đươc 1 ngày nên nhiều cái đọc vẫn chưa hiểu lắm và chưa biết phải down mấy cái thư viện ở đâu? ai đã config bản php mới nhất connect với mysql mới nhất vui lòng giúp đỡ với
vanlang viết 00:57 ngày 10/10/2018
tui đồng ý với bạn nguyenhaanh_us .... vì mặc định trong php5, mysql kô được enable :
In PHP 5, MySQL is no longer enabled by default, nor is the MySQL library bundled with PHP.
Trích từ http://www.php.net/manual/en/ref.mysql.php
nếu bạn muốn xài được mysql thì bạn phải enable cái mysql extension trong file php.ini và file libmysql.dll phải nằm trong thư mục system (C:\Windows\System32) họăc là bạn phải tạo path cho nó ...
Windows users will need to enable php_mysql.dll inside of php.ini and either copy libmysql.dll into the Windows system directory, or make it available to the PATH
tuy nhiên vl đã làm theo cái site nó chỉ ... nhưng still got "Unable to lead dynamic library 'C:/php/ext/php_mysql.dll' - The specified module could not be found "
chả hiểu thế nào nữa ... hỗng lẽ giờ xài lại thằng php4 seo chời ..
anyone can help meeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
nguyenhaanh_us viết 01:01 ngày 10/10/2018
Chẳng ai giúp cả, với lại MYSQL 4.1.3 thay đổi cả máy hàm gọi sql từ php nên đành sài lại PHP 4 và my SQL 4.0 vậy
vanlang viết 00:59 ngày 10/10/2018
cái chính là mình muốn xài oop trong php5 nên mới điên thế chứ ... lỡ rùi phải theo lao a/ ... hy vọng có ai install thành công roài vô help bà con với .................................................. ...........................
vanlang viết 01:10 ngày 10/10/2018
done ... tất cả đã xong ... bi giờ vl đã có thể xài php5 với mysql 4.1 mới tinh .....
bi giờ xin chia sẽ với các bạn đôi chút
-------------------------------------------------
"warning : mysql_connect(): Client does not suport authentication protocol requested by server, consider upgrading MySQL client " <---- về vấn đề này là do mysql 4.1 nó sử dụng thuật toán mã hóa mới mà các phiên bản cũ chưa có. Để giải quyết vấn đề này đơn giản bạn chỉ cần sử dụng hàm OLD_PASSWORD để set lại password ... nếu chỉ có mỗi root thì cũng chơi lun nhé (chứ bít seo bi giờ ... or bạn tạo thêm 1 user để connect ... vl khoái chơi với root ... vì chỉ có mình xài thôi mà sợ gì :P)
mysql> SET PASSWORD FOR
-> 'some_user'@'some_host' = OLD_PASSWORD('newpwd');
hoặc sử dụng :
mysql> UPDATE mysql.user SET Password = OLD_PASSWORD('newpwd')
-> WHERE Host = 'some_host' AND User = 'some_user';
mysql> FLUSH PRIVILEGES;

(Nguồn http://dev.mysql.com/doc/mysql/en/Old_client.html)
===============================================
còn cái vụ : Unable to lead dynamic library 'C:/php/ext/php_mysql.dll
là do vl hì hoạch mãi mà quên ... chưa restart lại máy nên cái com nó kô nhận được path mới :P ... giờ thì ổn roài ... chạy ầm ầm ... các bạn cứ coi cái link vl post bên trên mà config ... đảm bảo ok ...
viendong991986 viết 00:57 ngày 10/10/2018
giúp dùm nhé
sao điền vào phần SQL cua IBF nó lại báo lỗi như thế này đây:
Fatal error: Call to undefined function mysql_connect() in f:\appserv2\www\store\ibf13fn\sm_install.php on line 341
Mong các bạn giúp dùm.
Chìa Khóa viết 01:06 ngày 10/10/2018
Quote Được gửi bởi cuchuoichamcom
Mysql server của tớ là version 4.1.
Tớ cài PHP 5.0.2
test phpinfo chạy vẫn tít.
Thử connect trong Command Window : mysql>mysql -u root -pmypassword, vẫn connect vô tư
thế mà thử connect đến database thì không được , báo lỗi như sau:
"warning : mysql_connect(): Client does not suport authentication protocol requested by server, consider upgrading MySQL client in c:\inetpub\wwwroot\testphp.php online 2
khong ket noi duoc"
code la :
<?
mysql_connect("localhost", "root", "mypassword")
or die("khong ket noi duoc");
print("ket noi thanh cong");
?>

Vậy xin các bạn giúp tớ lỗi này . Thanks

p/s: muốn user của admin không phải là "root" thì thì làm thê nào ??
Thanks, mong hồi âm.
Bạn đọc & Làm theo :

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

To solve this problem, you should use one of the following approaches:

Upgrade all client programs to use a 4.1.1 or newer client library.
When connecting to the server with a pre-4.1 client program, use an account that still has a pre-4.1-style password.
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:

mysql> SET PASSWORD FOR
-> 'some_user'@'some_host' = OLD_PASSWORD('newpwd');

Alternatively, use UPDATE and FLUSH PRIVILEGES:

mysql> UPDATE mysql.user SET Password = OLD_PASSWORD('newpwd')
-> WHERE Host = 'some_host' AND User = 'some_user';
mysql> FLUSH PRIVILEGES;

Substitute the password you want to use for ``newpwd'' in the preceding examples. MySQL cannot tell you what the original password was, so you'll need to pick a new one.
Tell the server to use the older password hashing algorithm:
Start mysqld with the --old-passwords option.
Assign an old-format password to each account that has had its password updated to the longer 4.1 format. You can identify these accounts with the following query:

mysql> SELECT Host, User, Password FROM mysql.user
-> WHERE LENGTH(Password) > 16;

For each account record displayed by the query, use the Host and User values and assign a password using the OLD_PASSWORD() function and either SET PASSWORD or UPDATE, as described earlier.
Chắc chắn là OK
Bài liên quan
0