For at least 2 years now i have had the same problem in trying to connect to a MySQL database through MQL5 using 64bit architecture (https://www.mql5.com/en/forum/71114)
32bit was fine, but i have just rebuilt my PC and would really like to use 64bit if it is at all possible.
The initialization works fine and returns a non-null value, however the mysql_real_connect() function returns an error of "Access violation at 0x00007FF859046E72 read to 0x0000000031DEF670 in "
Has anyone been able to get around this problem? I'd be keen to hear if anyone has ever been able to connect to MySQL using 64bit, from searching the forums it seems that most projects are written in 32bit and a lot of people have found the same or similar issues with connecting through 64bit.
#property copyright "Copyright 2018, MetaQuotes Software Corp."
#property link "https://www.mql5.com"
#property version "1.00"
#define DELIM ";"
//----------------------- DLL IMPORTS
int mysql_init(int db);
int mysql_errno(int TMYSQL);
int mysql_real_connect( int TMYSQL,string host,string user,string password, string DB,int port,int socket,int clientflag);
int mysql_real_query(int TMYSQL,string query,int length);
void mysql_close(int TMYSQL);
int mysql_store_result(int TMYSQL);
string mysql_fetch_row(int result);
int mysql_num_rows(int result);
void mysql_free_result(int result);
//----------------------- OPEN DATABASE CONNECTION
void OnDeinit(const int reason)
mysql = mysql_init(mysql);
if (mysql!=0) Print("allocated");
string host = "localhost";
string user = "root";
string password = "password";
string DB = "fx";
int clientflag = 0;
int port = 3306;
int socket = 0;
long res = mysql_real_connect(mysql,host,user,password,DB,port,socket,clientflag);
int err = GetLastError();
if (res==mysql) Print("connected");
else Print("error=",mysql," ",mysql_errno(mysql)," ");