13.06.2015, 23:48
A few days ago I setup a SA-MP Server with a MySQL database. I have setup the password and everything right but everytime I start my server I still get "[MYSQL]: [ERROR]: Connection to `samp` failed!"
Also I changed my password in the MySQL tab to "password" for now, with this.
And then in "confic.inc.php" aswell. XAMPP still connects to phpmyadmin so I dont get why SAMP wont. Here's my code.
Also I changed my password in the MySQL tab to "password" for now, with this.
Код:
UPDATE mysql.user SET Password=PASSWORD('password') WHERE User='root'; FLUSH PRIVILEGES;
Код:
#define MySQL_HOST "localhost" #define MySQL_USER "root" #define MySQL_PASS "password" #define MySQL_DB "samp" public OnGameModeInit() { mysql_debug(1); mysql_connect(MySQL_HOST, MySQL_USER, MySQL_PASS, MySQL_DB); if(mysql_ping() == 1) { mysql_debug(1); printf("[MYSQL]: Connection to `%s` succesful!", MySQL_DB); } else { printf("[MYSQL]: [ERROR]: Connection to `%s` failed!", MySQL_DB); } mysql_query("CREATE TABLE IF NOT EXISTS playerdata(user VARCHAR(24), password VARCHAR(41), score INT(20), money INT(20), IP VARCHAR(16) )"); return 1; } public OnGameModeExit() { mysql_close(); return 1; }