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_ERRORS, 1);
mysql_connect("localhost", "root", " ", "ccnr", connection, 1);
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
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
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
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
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
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.