SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 26/12/2016, 11:00 AM   #1
Ahmed21
Big Clucker
 
Join Date: Jul 2016
Posts: 158
Reputation: 3
Default mysql_connect no access

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?!
Ahmed21 is offline   Reply With Quote
Old 26/12/2016, 11:02 AM   #2
Younes44
Gangsta
 
Younes44's Avatar
 
Join Date: Oct 2013
Posts: 763
Reputation: 80
Default Re: mysql_connect no access

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);
__________________
Left SA:MP, and not avalaible anymore!!
Thanks samp for awesome moments, i enjoy!! Goodbye!
ModernFreeroam: www.mf-samp.com , IP:94.23.255.30:7777
CounterTerroristUnit: www.ctu.w4f.eu , IP:87.98.243.201:6969
xSF: www.xsfserver.com , IP: 87.98.243.201:6969
Exm: www.exmserv.me , IP: exmserv.me:7777
Underground Stunting: www.ustunting.com , IP:145.239.3.225:7777

Thanks everyone,for the awesome moments,
Regards, COD Ghosts owner.
Younes44 ,YOuNeS_Dz ,WarZ ,Bryan_ , Kaneki
Younes44 is offline   Reply With Quote
Old 26/12/2016, 11:09 AM   #3
Ahmed21
Big Clucker
 
Join Date: Jul 2016
Posts: 158
Reputation: 3
Default Re: mysql_connect no access

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.
Ahmed21 is offline   Reply With Quote
Old 26/12/2016, 11:12 AM   #4
Younes44
Gangsta
 
Younes44's Avatar
 
Join Date: Oct 2013
Posts: 763
Reputation: 80
Default Re: mysql_connect no access

Quote:
Originally Posted by Sunehildeep View Post
Have you installed wamp/xamp on your PC?
this should work..
__________________
Left SA:MP, and not avalaible anymore!!
Thanks samp for awesome moments, i enjoy!! Goodbye!
ModernFreeroam: www.mf-samp.com , IP:94.23.255.30:7777
CounterTerroristUnit: www.ctu.w4f.eu , IP:87.98.243.201:6969
xSF: www.xsfserver.com , IP: 87.98.243.201:6969
Exm: www.exmserv.me , IP: exmserv.me:7777
Underground Stunting: www.ustunting.com , IP:145.239.3.225:7777

Thanks everyone,for the awesome moments,
Regards, COD Ghosts owner.
Younes44 ,YOuNeS_Dz ,WarZ ,Bryan_ , Kaneki
Younes44 is offline   Reply With Quote
Old 26/12/2016, 11:20 AM   #5
Ahmed21
Big Clucker
 
Join Date: Jul 2016
Posts: 158
Reputation: 3
Default Re: mysql_connect no access

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.
Ahmed21 is offline   Reply With Quote
Old 26/12/2016, 11:55 AM   #6
Ahmed21
Big Clucker
 
Join Date: Jul 2016
Posts: 158
Reputation: 3
Default Re: mysql_connect no access

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!
Ahmed21 is offline   Reply With Quote
Old 26/12/2016, 12:10 PM   #7
Lordzy
High-roller
 
Lordzy's Avatar
 
Join Date: Mar 2012
Location: NetherRealm
Posts: 2,698
Reputation: 1177
Default Re: mysql_connect no access

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;
__________________
Currently inactive - I don't play at any SA-MP servers nor work on anything in PAWN for now. The projects that I've done so far in PAWN, which requires updates will be taking some time.
Lordzy is offline   Reply With Quote
Old 26/12/2016, 03:50 PM   #8
Ahmed21
Big Clucker
 
Join Date: Jul 2016
Posts: 158
Reputation: 3
Default Re: mysql_connect no access

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..?
Ahmed21 is offline   Reply With Quote
Old 26/12/2016, 03:58 PM   #9
StrikerZ
High-roller
 
StrikerZ's Avatar
 
Join Date: Mar 2016
Location: Asgard
Posts: 1,050
Reputation: 154
Default Re: mysql_connect no access

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.
__________________
StrikerZ is offline   Reply With Quote
Old 26/12/2016, 04:02 PM   #10
Lordzy
High-roller
 
Lordzy's Avatar
 
Join Date: Mar 2012
Location: NetherRealm
Posts: 2,698
Reputation: 1177
Default Re: mysql_connect no access

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.
__________________
Currently inactive - I don't play at any SA-MP servers nor work on anything in PAWN for now. The projects that I've done so far in PAWN, which requires updates will be taking some time.
Lordzy is offline   Reply With Quote
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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Tag Mismatch - MySQL_Connect Dokins Scripting Help 3 26/06/2016 11:40 PM
Mysql_connect yvoms Scripting Help 4 22/11/2015 10:31 AM
Strickenkid's mysql_connect() ViPGuy Scripting Help 6 16/09/2012 11:08 AM
Strickens mysql_connect Sascha Help Archive 7 16/01/2011 08:45 PM
mysql_connect question DeathOnaStick Help Archive 8 24/07/2010 12:29 PM


All times are GMT. The time now is 02:57 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.