SA-MP Forums Archive
MySQL problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Other (https://sampforum.blast.hk/forumdisplay.php?fid=7)
+--- Forum: Everything and Nothing (https://sampforum.blast.hk/forumdisplay.php?fid=23)
+--- Thread: MySQL problem (/showthread.php?tid=627425)

Pages: 1 2


MySQL problem - AndreiWow - 27.01.2017

!: 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;
}



Re: MySQL problem - renatog - 27.01.2017

What MySQL plugin are you using? What tutorial are you reading?


Re: MySQL problem - AndreiWow - 27.01.2017

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

And R6


Re: MySQL problem - renatog - 28.01.2017

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)


Re: MySQL problem - DerickClark - 28.01.2017

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);
    }



Re: MySQL problem - AndreiWow - 28.01.2017

Still failed to connect..


Re: MySQL problem - DerickClark - 28.01.2017

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


Re: MySQL problem - AndreiWow - 28.01.2017

Quote:
Originally Posted by DerickClark
View Post
Latest


Re: MySQL problem - DerickClark - 28.01.2017

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


Re: MySQL problem - AndreiWow - 28.01.2017

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;
}



Re: MySQL problem - renatog - 28.01.2017

Check MySQL log...


Re: MySQL problem - DerickClark - 28.01.2017

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


Re: MySQL problem - AndreiWow - 28.01.2017

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.


Re: MySQL problem - DerickClark - 28.01.2017

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


Re: MySQL problem - AndreiWow - 28.01.2017

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


Re: MySQL problem - renatog - 28.01.2017

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.


Re: MySQL problem - Snich - 05.02.2017

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


Re: MySQL problem - Vince - 05.02.2017

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.


Re: MySQL problem - BlackBank - 05.02.2017

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.


Re: MySQL problem - DRIFT_HUNTER - 05.02.2017

Is your user associated with database?