Mysql connect
#1

Hi

How can i connect to mysql to my computer localhost! Must be easy thanks
Reply
#2

Only put localhost
Reply
#3

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!
Reply
#4

https://sampforum.blast.hk/showthread.php?tid=38561
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)