MySQL Error.
#1

Hello dears.
How can i fix this? i'm using CZ cnr gamemode And Ultra-h host.
Quote:

[20:50:38] Server Plugins
[20:50:38] --------------
[20:50:38] Loading plugin: crashdetect.so
[20:50:38] CrashDetect v4.15.1 is OK.
[20:50:38] Loaded.
[20:50:38] Loading plugin: streamer.so
[20:50:38] Loaded.
[20:50:38] Loading plugin: mysql.so
[20:50:38] SA:MP MySQL Plugin v2.1.1 Loaded.
[20:50:38] Loaded.
[20:50:38] [MySQL] Thread running. Threadsafe: Yes.
[20:50:38] Loading plugin: socket.so
[20:50:38] Socket plugin v0.2b loaded.
[20:50:38] Loaded.
[20:50:38] Loading plugin: MapAndreas.so
[20:50:38] Loaded.
[20:50:38] Loading plugin: audio.so
[20:50:38]

*** Audio Plugin v0.5 R2 by Incognito loaded ***

[20:50:38] Loaded.
[20:50:38] Loading plugin: mysql_static.so
[20:50:38] SA:MP MySQL Plugin v2.1.1 Loaded.
[20:50:38] Loaded.
[20:50:38] Loading plugin: libRegEx.so
[20:50:38] [MySQL] Thread running. Threadsafe: Yes.
[20:50:38]
[20:50:38] ------------------------------
[20:50:38] |
[20:50:38] | -> Regular Expression Plugin v0.2
[20:50:38] | -> Using Oniguruma v5.9.1
[20:50:38] |
[20:50:38] ------ © 2014, Koala -------
[20:50:38]
[20:50:38] Loaded.
[20:50:38] Loading plugin: whirlpool.so
[20:50:38]
[20:50:38] ==================
[20:50:38]
[20:50:38] Whirlpool loaded
[20:50:38]
[20:50:38] ==================
[20:50:38]
[20:50:38] Loaded.
[20:50:38] Loading plugin: libRegEx_static.so
[20:50:38]
[20:50:38] ------------------------------
[20:50:38] |
[20:50:38] | -> Regular Expression Plugin v0.2
[20:50:38] | -> Using Oniguruma v5.9.5
[20:50:38] |
[20:50:38] ------ © 2014, Koala -------
[20:50:38]
[20:50:38] Loaded.
[20:50:38] Loading plugin: sscanf.so
[20:50:38]

[20:50:38] ===============================

[20:50:38] sscanf plugin loaded.

[20:50:38] Version: 2.8.1

[20:50:38] © 2012 Alex "******" Cole

[20:50:38] ===============================

[20:50:38] Loaded.
[20:50:38] Loaded 11 plugins.

[20:50:38]
[20:50:38] Filterscripts
[20:50:38] ---------------
[20:50:38] Loading filterscript 'UltraHost.amx'...
[20:50:38] Loading filterscript 'gps.amx'...
[20:50:38]
--------------------------------------
[20:50:38] GPS System Loaded
[20:50:38] 0, -2438.551025, 741.183044, 35.107868, Supa Save
[20:50:38] 1, -1795.019897, 576.496948, 35.166793, VIP Lounge
[20:50:38] 2, -1927.602294, 261.575897, 40.718589, Vehicle Dealership SF
[20:50:38] 3, -2621.093017, 217.150161, 4.283658, Ammunation
[20:50:38] 4, -2632.546142, 619.860168, 14.132818, Hospital
[20:50:38] 5, -1890.214599, 813.722656, 35.422653, Job Center
[20:50:38] 6, -1777.782958, 1201.687133, 24.803468, Bomb Shop
[20:50:38] 7, -1566.389892, 1170.356201, 7.187500, Mini-Games
[20:50:38] 8, -1508.060424, 923.515014, 6.869043, San Fierro Bank
[20:50:38] 12, -1424.326660, -292.509002, 14.148400, Airport SF
[20:50:38] GPS System Loaded...
[20:50:38] --------------------------------------

[20:50:38] Loading filterscript 'shouryamaps.amx'...
[20:50:38] Loading filterscript 'antirapidfire.amx'...
[20:50:38] Loading filterscript 'vehiclename.amx'...
[20:50:38]
--------------------------------------
[20:50:38] Loaded Vehicle Names v1.1
[20:50:38] by biltong
[20:50:38] --------------------------------------

[20:50:38] Loading filterscript 'Helmet.amx'...
[20:50:38] Loading filterscript 'FarmerJob.amx'...
[20:50:38]
----------------------------
[20:50:38] Farmer Job FS Made by Virusa1
[20:50:38] ----------------------------

[20:50:38] Loaded 7 filterscripts.

[20:50:38]
[20:50:38]
[20:50:38]
[20:50:38] =======================================
[20:50:38] | |
[20:50:38] | YSI version 3.09.0684 |
[20:50:38] | By Alex "******" Cole |
[20:50:38] | |
[20:50:38] =======================================
[20:50:38]
[20:50:38] [MySQL] Error (0): Failed to connect. Access denied for user 'server_142'@'localhost' to database 'server_142'.
[20:50:38] Failed to connect. Access denied for user 'server_142'@'localhost' to database 'server_142'.
[20:50:38] Loading Vehicles
[20:50:38] (1) Loaded! Owner: 24
[20:50:38] (2) Loaded! Owner: 24
[20:50:38] (3) Loaded! Owner: 24
[20:50:38] (4) Loaded! Owner: 24
[20:50:38] (5) Loaded! Owner: 24
[20:50:38] (6) Loaded! Owner: 24
[20:50:38] (7) Loaded! Owner: 24
[20:50:38] ( Loaded! Owner: 110781
[20:50:38] (9) Loaded! Owner: 110781
[20:50:38] [MySQL] Error (0): Function: mysql_query called when not connected to any database. Access denied for user 'server_142'@'localhost' to database 'server_142'.
[20:50:38] Function: mysql_query called when not connected to any database. Access denied for user 'server_142'@'localhost' to database 'server_142'.
[20:50:38]
-----------------------------------
[20:50:38] Cops and Robbers, by shourya

Reply
#2

Your database settings are not set properly.
Reply
#3

Quote:
Originally Posted by Terzic
Посмотреть сообщение
Your database settings are not set properly.
Bro tell me how can i set it properly.
Reply
#4

Use 127.0.0.1 instead of localhost
Reply
#5

I had this error a long, long time ago and it was just that I had the password and username the wrong way around.

Код:
mysql_connect("localhost", /*"USERNAME"*/, "server_142", /*"PASSWORD"*/);
Make sure you got it like that.
Reply
#6

Quote:
Originally Posted by kovac
Посмотреть сообщение
Use 127.0.0.1 instead of localhost
Quote:

public OnGameModeInit()
{
profileStuff();
f_init();
connection = mysql_init(LOG_ONLY_ERRORS, 1);

mysql_connect("127.0.0.1", "server_142", "dontknow", "server_142", connection, 1);

Bro check my setting but it still not working!
Reply
#7

Quote:
Originally Posted by Hassyy
Посмотреть сообщение
Bro check my setting but it still not working!
Help me please?
Reply
#8

As far as I know, Ultra-H's databases are named like server_142_DATABASENAME.
You need to create a new database ( I guess it's done through CP > MySQL > Create new database )

PHP код:
// At the top of your gamemode
new MySQLDatabase;
#define MYSQL_HOST "127.0.0.1"
#define MYSQL_USER "server_142"
#define MYSQL_PASS "PASSWORD"
#define MYSQL_DATABASE "server_142_DATABASENAME" 
PHP код:
// OnGameModeInit
new MySQLOptoption_id mysql_init_options();
    
mysql_set_option(option_idAUTO_RECONNECTtrue); // We will set that option to automatically reconnect on timeouts.
    
Database mysql_connect(MYSQL_HOSTMYSQL_USERMYSQL_PASSMYSQL_DATABASEoption_id);
    if(
Database == MYSQL_INVALID_HANDLE || mysql_errno(Database) != 0// Checking if the database connection is invalid to shutdown.
    
{
        print(
"MySQL Database: Connection to database failed!");
        
SendRconCommand("exit");
        return 
1;
    }
    else
        print(
"MySQL Database: Successfully connected."); 
Reply
#9

Quote:
Originally Posted by kovac
Посмотреть сообщение
As far as I know, Ultra-H's databases are named like server_142_DATABASENAME.
You need to create a new database ( I guess it's done through CP > MySQL > Create new database )

PHP код:
// At the top of your gamemode
new MySQLDatabase;
#define MYSQL_HOST "127.0.0.1"
#define MYSQL_USER "server_142"
#define MYSQL_PASS "PASSWORD"
#define MYSQL_DATABASE "server_142_DATABASENAME" 
PHP код:
// OnGameModeInit
new MySQLOptoption_id mysql_init_options();
    
mysql_set_option(option_idAUTO_RECONNECTtrue); // We will set that option to automatically reconnect on timeouts.
    
Database mysql_connect(MYSQL_HOSTMYSQL_USERMYSQL_PASSMYSQL_DATABASEoption_id);
    if(
Database == MYSQL_INVALID_HANDLE || mysql_errno(Database) != 0// Checking if the database connection is invalid to shutdown.
    
{
        print(
"MySQL Database: Connection to database failed!");
        
SendRconCommand("exit");
        return 
1;
    }
    else
        print(
"MySQL Database: Successfully connected."); 
Thanku Soo Much brother now my server is working fine Thanku
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)