SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 24/11/2016, 06:07 PM   #1
GuitarMan
Little Clucker
 
Join Date: Oct 2014
Posts: 43
Reputation: 0
Default MySQL connection problem.

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.
GuitarMan is offline   Reply With Quote
Old 24/11/2016, 06:14 PM   #2
Konstantinos
Spam Machine
 
Konstantinos's Avatar
 
Join Date: Dec 2011
Posts: 11,827
Reputation: 1401
Default Re: MySQL connection problem.

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: http://wiki.sa-mp.com/wiki/MySQL/R40#mysql_connect
__________________
Life is like riding a bicycle. To keep your balance, you must keep moving.

[Tutorial] How to use SQLite
[FilterScript] Tune System
Konstantinos is offline   Reply With Quote
Old 24/11/2016, 06:30 PM   #3
GuitarMan
Little Clucker
 
Join Date: Oct 2014
Posts: 43
Reputation: 0
Default Re: MySQL connection problem.

This is completely for testing purpose.
Thanks alot!
GuitarMan is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Mysql connection problem radiobizza Scripting Help 3 22/09/2016 04:34 AM
MySQL connection problem. Glenn332 Scripting Help 22 30/01/2015 09:39 PM
Big problem with MySQL connection. Ricop522 Scripting Help 3 21/08/2012 06:30 PM
MYSQL connection problem vection Help Archive 1 12/10/2010 05:50 PM
MYSQL connection problem - please take a look at that Ed2ka49 Help Archive 4 04/08/2010 09:09 PM


All times are GMT. The time now is 12:23 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.