SA-MP Forums Archive
MYSQL Issue(Noob Alert) - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Server (https://sampforum.blast.hk/forumdisplay.php?fid=6)
+--- Forum: Server Support (https://sampforum.blast.hk/forumdisplay.php?fid=19)
+--- Thread: MYSQL Issue(Noob Alert) (/showthread.php?tid=616135)



MYSQL Issue(Noob Alert) - AlexuTzVs - 31.08.2016

Hello guys, as the title says i am a newb in MYSQL on sa-mp domain so i want to know how to configurate MYSQL_CONNECT for my server? At Host i put the IP of my website where there is the database. at user i place the user that i use to connect to cPanel and the password the same the one that is used to connect to cPanel

pawn Код:
SQL = mysql_connect("185.....","cPanelUser","cPanelPass", "cPanelDataBase");


01:49:33    CMySQLConnection::Connect   ERROR   (error #1045) Access denied for user 'cPanelUser'@'Here is showing my IP not the site's IP 185..... etc' (using password: YES)
01:49:33    CMySQLQuery::Execute    ERROR   (error #2006) MySQL server has gone away
01:49:33    cache_get_row_count WARNING no active cache
01:49:33    CMySQLConnection::Connect   ERROR   (error #1045) Access denied for user 'cPanel'@'same here wtf' (using password: YES)
01:49:38    CMySQLQuery::Execute    ERROR   (error #2006) MySQL server has gone away
I need to mention that my SA-MP Server is hosted from somewhere and the Website+Database somewhere else



Re: MYSQL Issue(Noob Alert) - MEW273 - 01.09.2016

You need to create a MySQL user via your website cPanel, you will need to specify the username, password and also what privileges to grant the user. Once you've created the MySQL user via cPanel use the same details in your MySQL connect function in your script. You may also need to allow remote access to the MySQL database from your server IP via cPanel.

CMySQLConnection::Connect ERROR (error #1045) Access denied for user 'cPanelUser'@'Here is showing my IP not the site's IP 185..... etc' (using password: YES)

It is normal for the MySQL log to show the username you entered "cPanelUser" followed by the user's IP, in this case your server computer's IP.

A quick ****** search returned this helpful page regarding the MySQL error you are receiving.
http://dev.mysql.com/doc/refman/5.7/en/gone-away.html
Quote:

Some other common reasons for the MySQL server has gone away error are:

...

A client application running on a different host does not have the necessary privileges to connect to the MySQL server from that host.



Re: MYSQL Issue(Noob Alert) - ev0lution - 01.09.2016

Sometimes MySQL servers are not set to accept remote connections, or you need to add access for your IP address.

The error "Access denied for user <user>@<your IP>" is because you can set up MySQL users so they can only log in from certain IP addresses - usually it's set to allow either local connections (localhost) or everything, but it seems like it's not the latter in your case. Try to change your MySQL user or create a new one that can be logged in from your IP.