AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved [MySQl] can t connect through socket (https://forums.alliedmods.net/showthread.php?t=333492)

lexzor 07-16-2021 12:16

[MySQl] can t connect through socket
 
hello, i got this error
Code:

L 07/16/2021 - 19:12:20: [AMXX] Plugin ("csgo_agents.amxx") is setting itself as failed.
L 07/16/2021 - 19:12:20: [AMXX] Plugin says: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
L 07/16/2021 - 19:12:20: [AMXX] Run time error 1 (plugin "csgo_agents.amxx") - forced exit

this is how i connect to mysql

PHP Code:

public plugin_precache()

    
read_sql_data();

}


public 
read_sql_data()
{

    
MySql_Init();
}


public 
MySql_Init()
{
    
g_SqlTuple SQL_MakeDbTuple(g_szPanelInfo[MYSQL_HOST], g_szPanelInfo[MYSQL_USER],g_szPanelInfo[MYSQL_PASS], g_szPanelInfo[MYSQL_DB])
       
    new 
ErrorCode,Handle:SqlConnection SQL_Connect(g_SqlTuple,ErrorCode,g_Error,charsmax(g_Error))
       
    if(
SqlConnection == Empty_Handle)
    {
        
set_fail_state(g_Error)
    }
    
    new 
Handle:Queries
    
new szQuery[1024]
    
    
formatex(szQuerycharsmax(szQuery), "CREATE TABLE IF NOT EXISTS %s  ( `id` INT(11) NOT NULL AUTO_INCREMENT , `name` VARCHAR(255) NOT NULL , `steamid` VARCHAR(255) NOT NULL , `last_ct_agent` VARCHAR(255) NOT NULL , `last_t_agent` VARCHAR(255) NOT NULL , PRIMARY KEY (`id`))"g_szTable)    

    
Queries SQL_PrepareQuery(SqlConnectionszQuery)

    if(!
SQL_Execute(Queries))
    {
        
SQL_QueryError(Queries,g_Error,charsmax(g_Error))
        
set_fail_state(g_Error)     
    }        
    
    
server_print("[CSGO AGENTS] SQL Connection to server database has been realized succesfully!")
    
    
SQL_FreeHandle(Queries)
    
    
SQL_FreeHandle(SqlConnection)   


others plugin work perfect, but this seems to not work even if i used it on another server and worked.

Natsheh 07-16-2021 13:49

Re: [MySQl] can t connect through socket
 
try to connect using ur ip private address instead of "localhost"

lexzor 07-20-2021 15:09

Re: [MySQl] can t connect through socket
 
ok the plugin couldn t get the correct sql data.

thanks.


All times are GMT -4. The time now is 02:36.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.