View Single Post
Author Message
lexzor
Veteran Member
Join Date: Nov 2020
Old 07-16-2021 , 12:16   [MySQl] can t connect through socket
Reply With Quote #1

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.

Last edited by lexzor; 07-20-2021 at 15:09.
lexzor is offline