SA-MP Forums Archive
Failed to connect for user 'root'@'localhost' - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Failed to connect for user 'root'@'localhost' (/showthread.php?tid=410550)



Failed to connect for user 'root'@'localhost' - Noles2197 - 25.01.2013

Код:
----------
Loaded log file: "server_log.txt".
----------

SA-MP Dedicated Server
----------------------
v0.3e-R2, ©2005-2012 SA-MP Team

[18:53:39] filterscripts = ""  (string)
[18:53:39] 
[18:53:39] Server Plugins
[18:53:39] --------------
[18:53:39]  Loading plugin: mysql
[18:53:39]  SA:MP MySQL Plugin v2.1.1 Loaded.
[18:53:39]   Loaded.
[18:53:39] [MySQL] Thread running. Threadsafe: Yes.
[18:53:39]  Loaded 1 plugins.

[18:53:39] 
[18:53:39] Filterscripts
[18:53:39] ---------------
[18:53:39]   Loaded 0 filterscripts.

[18:53:39] [MySQL] Error (0): Failed to connect. Access denied for user 'root'@'localhost' (using password: YES).
[18:53:39] [MySQL] Error (0): Function: mysql_ping called when not connected to any database. Access denied for user 'root'@'localhost' (using password: YES).
[18:53:39] MySQL connection to sanfierro failed
[18:53:39] Number of vehicle models: 0



Re: Failed to connect for user 'root'@'localhost' - Djole1337 - 25.01.2013

That means your connection was unsuccessful.

May be wrong password/not enough premissions.


Re: Failed to connect for user 'root'@'localhost' - Noles2197 - 26.01.2013

The password is correct, so I don't know what to do.


Re: Failed to connect for user 'root'@'localhost' - [KHK]Khalid - 26.01.2013

Are you sure you're using mysql_connect properly? Can you show us code?


Re: Failed to connect for user 'root'@'localhost' - Noles2197 - 26.01.2013

pawn Код:
#include <a_samp>
#include <mysql>
#include <zcmd>

#define MySQL_hostname "localhost"
#define MySQL_username "root"
#define MySQL_password ""
#define MySQL_database "sanfierro"

main() {}

public OnGameModeInit()
{
    mysql_init();
    mysql_connect("127.0.0.1","root","sanfierro","");
    if(mysql_ping()) printf("MySQL connection to %s successful",MySQL_database);
    else printf("MySQL connection to %s failed",MySQL_database);
    return 1;
}

public OnGameModeExit()
{
    mysql_close();
    return 1;
}



Re: Failed to connect for user 'root'@'localhost' - Scenario - 26.01.2013

Quote:

Access denied for user 'root'@'localhost'

Either you are using an incorrect password, or attempting to connect to a user who can only accept connections from a particular location (i.e. a specific IP address).


Re: Failed to connect for user 'root'@'localhost' - Noles2197 - 26.01.2013

How do I check which locations it will accept from?


Re: Failed to connect for user 'root'@'localhost' - Scenario - 26.01.2013

If you use phpMyAdmin, you can log in via the root account and click on the "users" tab. It will show you next to each user something like "localhost" or "@". The @ would mean that it will accept connections from anywhere.

localhost means it only accepts connections from localhost; although I don't believe this includes 127.0.0.1 on Windows Vista/7.


Re: Failed to connect for user 'root'@'localhost' - Noles2197 - 26.01.2013

I can't find a privileges tab anywhere.


Re: Failed to connect for user 'root'@'localhost' - Noles2197 - 26.01.2013

I don't see what the problem is to why it can't connect. Can someone who knows what they're talking about please help?