Raised This Month: $12 Target: $400
 3% 

Solved [MySQl] can t connect through socket


Post New Thread Reply   
 
Thread Tools Display Modes
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
Natsheh
Veteran Member
Join Date: Sep 2012
Old 07-16-2021 , 13:49   Re: [MySQl] can t connect through socket
Reply With Quote #2

try to connect using ur ip private address instead of "localhost"
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
lexzor
Veteran Member
Join Date: Nov 2020
Old 07-20-2021 , 15:09   Re: [MySQl] can t connect through socket
Reply With Quote #3

ok the plugin couldn t get the correct sql data.

thanks.
lexzor is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:12.


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