SA-MP Forums Archive
mysql_connect no access - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: mysql_connect no access (/showthread.php?tid=624996)



mysql_connect no access - Ahmed21 - 26.12.2016

Hello, I got a problem, it says on the server-samp file:

Code:
[MySQL] Error (0): Failed to connect. Access denied for user 'root'@'localhost' (using password: YES).
Here's the thing that I have on OnGameModeInit:
PHP Code:
connection mysql_init(LOG_ONLY_ERRORS1);
    
mysql_connect("localhost""root"" ""ccnr"connection1); 
What is wrong with it?!


Re: mysql_connect no access - Younes44 - 26.12.2016

well. Is this MySQL From your pc? if no ? then your code should be like that
Quote:

mysql_connect("localhost", "root", "password", "ccnr", connection, 1);




Re: mysql_connect no access - Ahmed21 - 26.12.2016

Quote:
Originally Posted by Younes44
View Post
well. Is this MySQL From your pc? if no ? then your code should be like that
Mate, yeah, it's on my PC, I want to run it into my localhost IP, not on a host.


Re: mysql_connect no access - Younes44 - 26.12.2016

Quote:
Originally Posted by Sunehildeep
View Post
Have you installed wamp/xamp on your PC?
this should work..


Re: mysql_connect no access - Ahmed21 - 26.12.2016

Quote:
Originally Posted by Younes44
View Post
this should work..
Of course, I have another server working on MySQL and when I run it on localhost and works well, but this one ain't working.


Re: mysql_connect no access - Ahmed21 - 26.12.2016

I edited the database and host and password and matched it with the host one, then uploaded it to the host and I started the server, and same exact error shows up again.

Help!


Re: mysql_connect no access - Lordzy - 26.12.2016

Run this query on your MySQL server (Use root):
Code:
GRANT ALL PRIVILEGES ON *.* TO 'your_user'@'your_host/localhost' IDENTIFIED BY 'your_password' WITH GRANT OPTION;



Re: mysql_connect no access - Ahmed21 - 26.12.2016

Quote:
Originally Posted by Lordzy
View Post
Run this query on your MySQL server (Use root):
Code:
GRANT ALL PRIVILEGES ON *.* TO 'your_user'@'your_host/localhost' IDENTIFIED BY 'your_password' WITH GRANT OPTION;
I don't know where is root and where to write this and where to run it..?


Re: mysql_connect no access - StrikerZ - 26.12.2016

This means you can't access it unless you're running it on the same machine the mysql is hosted. Cuz I get this error when I try to get a mysql connection of another machine. So use remote mysql or get SQL from http://mysql.db4free.net and try.


Re: mysql_connect no access - Lordzy - 26.12.2016

Don't rely on connecting remotely, it's slow.

Quote:
Originally Posted by Ahmed21
View Post
I don't know where is root and where to write this and where to run it..?
Login as root on phpMyAdmin and execute this query.

PS : Are you using any free/paid host as shown in your signature? Because you'll have to contact your support team instead.