Mysql connect - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Mysql connect (
/showthread.php?tid=623737)
Mysql connect -
Hunud - 04.12.2016
Hi
How can i connect to mysql to my computer localhost! Must be easy thanks
Re: Mysql connect -
Marllun - 04.12.2016
Only put localhost
Re: Mysql connect -
Hansrutger - 04.12.2016
I found this very useful when I had trouble at first learning MySQL:
https://sampwiki.blast.hk/wiki/MySQL/R33#mysql_connect
Find mysql_connect and look at the example there. To connect specifically to localhost you can use "localhost" or like it said in that example. After connecting use a test with printf to see if you connected successfully, for instance something like this:
Код:
if (!mysql_errno(MySQL))
{
printf("MySQL connected properly!");
}
Another tip is to download a gamemode that is using MySQL, find one that uses threading and non-threading (mysql_tquery vs mysql_query). That way you will learn both ways of when you can afford using a multi-threading scenario (which is preferred, using threads = you can "perform" multiple things at once) but also learn how to use normal query's when you shouldn't wait on the main thread. Cheers mate good luck!
Re: Mysql connect -
RyderX - 04.12.2016
https://sampforum.blast.hk/showthread.php?tid=38561