Hi, some people gave me this attached code to connect
to mysql over Net.
Its looks cool and my provider did it for me so I can also connect over Net. Now I get from this Code the Message:
"Client does not support authentication protocol requested by server, consider upgrading mysql client"
So, does anyone have an idea how I insert this Authentication protocol???
thx
chris
; English forum: http://purebasic.myforums.net/viewtopic.php?t=2734
; Author: Max
; Date: 22. April 2003
; Example for using MySQL with the libmysql.dll (download from
; http://www.mysqltools.com/download.htm)
; SQLite ist eine eigenständige Datenbankengine, die zwar die SQL92
; Syntax unterstützt, sonst aber mit MySQL nichts zu tun hat.
;
; Wenn Du übers Internet auf eine MySQL Datenbank zugreifen
; möchtest kannst Du das entweder über ODBC oder direkt mit der
; libmysql.dll -> http://www.mysqltools.com/download.htm realisieren.
; PS: Nachfolgend von Max aus dem Englischen Forum ein Beispiel für
; die Nutzung der libmysql.dll:
#libmysql = 1
host.s = "81.138.180.16"
user.s = "guxxvrah"
passwd.s = "123456"
db.s = "usrdb_gurcvrah"
port.l = 3306
dbHnd.l
SQL.s
row.s
i.l
j.l
affRows.l
fieldNum.l
rowsNum.l
Procedure.s GetError(db_ID,requester)
Protected Errormsg.s, i.l, Error.l
If CallFunction(#libmysql,"mysql_errno",db_ID) > 0
*Error =CallFunction(#libmysql,"mysql_error",db_ID)
i=-1
Repeat
i=i+1
Errormsg=Errormsg+PeekS(*Error+i,1)
Until PeekB(*Error+i)=0
If requester
Result= MessageRequester("MySQL error",Errormsg,#PB_MessageRequester_Ok)
EndIf
EndIf
ProcedureReturn Errormsg
EndProcedure
If OpenLibrary(#libmysql,"libmysql.dll")
Result=CallFunction(#libmysql,"mysql_init",dbHnd)
If Result
dbHnd = Result
If CallFunction(#libmysql,"mysql_real_connect",dbHnd, host, user, passwd, db, port, "", 0) = 0
GetError(dbHnd,1)
Else
CallDebugger
SQL = "SELECT * FROM test"
If CallFunction(#libmysql,"mysql_real_query", dbHnd, SQL, Len(SQL))
GetError(dbHnd,1)
Else
*mysqlResult=CallFunction(#libmysql,"mysql_store_result",dbHnd)
;no result returned
If *mysqlResult=0
;no fields returned means error
If CallFunction(#libmysql,"mysql_field_count",dbHnd)
GetError(dbHnd,1)
;fields are returned, so no error but query didn't return data
Else
EndIf
;results are returned
Else
affRows = CallFunction(#libmysql,"mysql_affected_rows",dbHnd)
fieldNum = CallFunction(#libmysql,"mysql_num_fields",*mysqlResult)
rowsNum = CallFunction(#libmysql,"mysql_num_rows",*mysqlResult)
Debug affRows
Debug fieldNum
Debug rowsNum
For i=1 To rowsNum
*mysqlRow=CallFunction(#libmysql,"mysql_fetch_row",*mysqlResult)
*mysqlLen=CallFunction(#libmysql,"mysql_fetch_lengths",*mysqlResult)
row = ""
;length of given field
For j=1 To fieldNum
length=PeekL(*mysqlLen+4*(j-1))
fieldptr=PeekL(*mysqlRow+4*(j-1))
If fieldptr>0
content.s=PeekS(fieldptr,length)
Else
;zero pointer returend means empty field
content="NULL"
EndIf
row = row + content + ";"
Next j
Debug row
Next i
Result.l=CallFunction(#libmysql,"mysql_free_result",*mysqlResult)
EndIf
EndIf
EndIf
EndIf
EndIf
; ExecutableFormat=Windows
; FirstLine=1
; EOF
libmysql.dll (error: does not support authentication Protoc
I believe the issue is that you are using a DLL designed for pre MySQL 4.1 servers. The password encryption is different with the newer versions of MySQL, that is why you are getting the error.
There is an easy (less secure) method to fix the problem. You can convert the password to the old style encryption and it should work. Here is how you would do this from the prompt:
I have used this method before and it works fine. YMMV.
There is an easy (less secure) method to fix the problem. You can convert the password to the old style encryption and it should work. Here is how you would do this from the prompt:
Code: Select all
mysql> UPDATE mysql.user SET Password = OLD_PASSWORD('newpwd')
-> WHERE Host = 'some_host' AND User = 'some_user';
mysql> FLUSH PRIVILEGES;
-Beach
- Fangbeast
- PureBasic Protozoa
- Posts: 4789
- Joined: Fri Apr 25, 2003 3:08 pm
- Location: Not Sydney!!! (Bad water, no goats)
Re: thank
viewtopic.php?t=12475&highlight=mysqlguruk wrote:thanks... i do not have mysql server installed on my machine.
no prob. downloaded the new libmysql.dll client.. and now work..
now i only need a good demo
greets
chris
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet