MySQL problem
#1

!: Sorry for posting here but I can't post in scripting help, this also happened to other people so it may be a bug, they posted in General about it.



Well my problem is this:
Code:
[MYSQL]: [ERROR]: Connection to `delceaga_samp` failed!
Why?

I am sure that I have the password and everything right in the defines.


Code:
public ConnectMySQL()
{
	mysql_connect(SQL_HOST, SQL_USER, SQL_DB, SQL_PASS);

	if(mysql_ping() == 1)
 	{
  		mysql_debug(1);
	    printf("[MYSQL]: Connection to `%s` succesful!", SQL_DB);
	}
	else
	{
	    printf("[MYSQL]: [ERROR]: Connection to `%s` failed!", SQL_DB);
	}
	return 1;
}
Reply
#2

What MySQL plugin are you using? What tutorial are you reading?
Reply
#3

I used this https://sampwiki.blast.hk/wiki/MySQL_Tutorial

And R6
Reply
#4

You're using BlueG's MySQL R6 plugin and reading a tutorial for G-sTyLeZzZ's MySQL plugin (I never heard about it, probably it's very old and the thread doesn't exist anymore)
Reply
#5

Quote:
Originally Posted by AndreiWow
View Post
Why not use R41-2? the lastest MySQL




R41-2 code

Code:
#define    MYSQL_HOST        "127.0.0.1"
#define    MYSQL_USER        "root"
#define    MYSQL_DATABASE    "databasename"
#define    MYSQL_PASSWORD    ""

    mysql = mysql_connect("127.0.0.1", "root", "", "dataname");
    if(mysql_errno() != 0) // checks if the server failed to connected or not
    {
        print("[MYSQL]: Failed to connect with using Following Informations: ");
        printf(" Host: %s | User: %s | Password: ****** | Database: %s", MYSQL_HOST, MYSQL_USER, MYSQL_DATABASE);
    }
    else
    {
        printf("[MYSQL]: Connection Success to database: %s !", MYSQL_DATABASE);
    }
Reply
#6

Still failed to connect..
Reply
#7

Quote:
Originally Posted by AndreiWow
View Post
Still failed to connect..
what plugin you are using?
https://github.com/pBlueG/SA-MP-MySQL/releases

https://sampforum.blast.hk/showthread.php?tid=627222
Reply
#8

Quote:
Originally Posted by DerickClark
View Post
Latest
Reply
#9

Quote:
Originally Posted by AndreiWow
View Post
Latest
Follow the login/ register tut
Reply
#10

I don't need that tutorial, I need my database to connect and it is not working, there is no difference from my code and that code...


Code:
public ConnectMySQL()
{

	MHandle = mysql_connect(SQL_HOST, SQL_USER, SQL_PASS, SQL_DB);
    if(mysql_errno() != 0)
    {
        print("[MYSQL]: Failed to connect with using Following Informations: ");
        printf(" Host: %s | User: %s | Password: ****** | Database: %s", SQL_HOST, SQL_USER, SQL_DB);
    }
    else
    {
        printf("[MYSQL]: Connection Success to database: %s !", SQL_DB);
    }
	return 1;
}
Reply
#11

Check MySQL log...
Reply
#12

Quote:
Originally Posted by renatog
Посмотреть сообщение
Check MySQL log...
or your defines are wrong. Are you local hosting it? (mysql)
Reply
#13

Quote:
Originally Posted by DerickClark
Посмотреть сообщение
or your defines are wrong. Are you local hosting it? (mysql)
Hosted on a server, Defines:
Код:
#define SQL_HOST "193.84.64.208"
#define SQL_USER "delceaga_samp"
#define SQL_PASS "*********"
#define SQL_DB "delceaga_samp"
Logs:
Код:
[04:37:45] [plugins/mysql] CConnection::CConnection - establishing connection to MySQL database failed: #1045 'Access denied for user 'delceaga_samp'@'82.76.171.22' (using password: YES)'
Not sure why? It works fine on other gamemode.
Reply
#14

Quote:
Originally Posted by AndreiWow
Посмотреть сообщение
Hosted on a server, Defines:
Код:
#define SQL_HOST "193.84.64.208"
#define SQL_USER "delceaga_samp"
#define SQL_PASS "*********"
#define SQL_DB "delceaga_samp"
Logs:
Код:
[04:37:45] [plugins/mysql] CConnection::CConnection - establishing connection to MySQL database failed: #1045 'Access denied for user 'delceaga_samp'@'82.76.171.22' (using password: YES)'
Not sure why? It works fine on other gamemode.
Did you create the database? in phpadmin
Reply
#15

Quote:
Originally Posted by DerickClark
Посмотреть сообщение
Did you create the database? in phpadmin
Yes, I used it for another server and everything worked fine...
Reply
#16

Quote:
Originally Posted by AndreiWow
Посмотреть сообщение
Hosted on a server, Defines:
Код:
#define SQL_HOST "193.84.64.208"
Код:
#1045 'Access denied for user 'delceaga_samp'@'82.76.171.22' (using password: YES)'
"Access denied for user".
The user doesn't have the permissions... Check if you're using the correct user.

"193.84.64.208" != "82.76.171.22"
Check the host, because they don't match.
Reply
#17

Because MySQL stopped being compatible with PHP so you need an extension that will "talk" with MySQL and PHP.
PDO_MYSQL is a driver that implements the PHP Data Objects (PDO) interface to enable access from PHP to MySQL 3.x, 4.x and 5.x databases.
MySQL extension is deprecated in PHP and removed in new verisons. Use MySQL PDO or MySqli entensions and it should fix your errors.
MORE ON LINK: http://php.net/manual/en/book.pdo.php
Reply
#18

Quote:
Originally Posted by AndreiWow
Посмотреть сообщение
I can't post in scripting help, this also happened to other people so it may be a bug
No, I think that's intentional. A limit of 5 threads per forum per day, or something. Damage control in case another huge spammer shows up. Added side-effect - or benefit, depending how you look at it - is that it also blocks people who ask too many questions.
Reply
#19

Quote:
Originally Posted by Snich
Посмотреть сообщение
Because MySQL stopped being compatible with PHP so you need an extension that will "talk" with MySQL and PHP.
PDO_MYSQL is a driver that implements the PHP Data Objects (PDO) interface to enable access from PHP to MySQL 3.x, 4.x and 5.x databases.
MySQL extension is deprecated in PHP and removed in new verisons. Use MySQL PDO or MySqli entensions and it should fix your errors.
MORE ON LINK: http://php.net/manual/en/book.pdo.php
If you did read the topic, you would notice he is not talking about PHP, but PAWN.
Reply
#20

Is your user associated with database?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)