MySQL connection problem.
#1

Hello,
I've got something very weird going on here.

I'm trying to connect to my database using MySQL, but it fails to find the db somehow.

My MySQL is running, been using it for my website for quite a while.
I did add the MySQL plugin and everything.

This is what my onGamemodeInit looks like
PHP Code:
    mysql mysql_connect("localhost""root""samp"""); 
The logins that i'm using are correct, for 100%.
I'm getting an error in mysql log file every time i'm starting the server : [ERROR] mysql_connect: handle error: no database specified

What could be the cause?
thank you.
Reply
#2

In R40+ version, the 3rd (database) and 4th (password) parameters are swapped so that'd be:
pawn Code:
mysql = mysql_connect("localhost", "root", "", "samp");
and will give a warning for not using a password. If it is for testing purposes then okay, but if not you should create a user with limited privileges.

Reference: https://sampwiki.blast.hk/wiki/MySQL/R40#mysql_connect
Reply
#3

This is completely for testing purpose.
Thanks alot!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)