Can't connect to MySQL Database in phpBB - mysql

I am trying to connect to a MySQL database using the mysql_connect() command however I keep getting the error message:
Warning: mysql_connect() [function.mysql-connect]: [2002] A connection attempt failed because the connected party did not (trying to connect via tcp://ravenwolftest.db.4292619.hostedresource.com:3306) in C:\Data\GITA\Web Design\Projects\Ravenwolf\LoginTest.php on line 12
Warning: mysql_connect() [function.mysql-connect]: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. in C:\Data\GITA\Web Design\Projects\Ravenwolf\LoginTest.php on line 12
I searched around in the phpBB folder and found in the config.php folder there was listed a host name, username, and password. I put those into the mysql_connect() line but get the same error. I am also using godaddy.com for web hosting in case that means anything. As for the code itself all I have is:
mysql_connect('ravenwolftest.db.4292619.hostedresource.com','ravenwolftest','password');
Thanks in advance for any help.

it seems that either the other server is down or does not allow external connections to the database.
i would suggest that you enable external access in your godaddy control panel

Do you control the machine ravenwolftest.db.4292619.hostedresource.com? Is MySQL running on it? If it's not your local machine, have you verified that MySQL is permitting connections from your machine?

Related

How do I connect a to a mysql database hosted on pythonanywhere?

I have bought a basic 6$ pythonanywhere server which allows for SCP and SSH connections to their servers. I have deployed my flask application (REST API) to the server and set up a local environment (installed packages, set up path and environmental variables). I ran the app, and it gives me the 404 page on the / route which is actually a sign that it is working.
However when I try to hit a route like /api/users/3 for example, it gives me an error 500 (internal server error). I dug around some log files on the server and found one which is basically the output of the WSGI web server which is host to my flask application. It said that there is an issue with the database communication. From what I understand, it connected successfully but it couldn't query the data from the table:
(1044, "Access denied for user 'secret_username'#'%' to database 'test'")
I have tried to fix this through the web mysql console by giving my <secret_username>#secret_username.pythonanywhere.com all the privilages to test.*, but it gives me an access error once again. I tried to SSH into the machine that is host to the mysql server and tried to connect to it - secret_username.mysql.pythonanywhere-services.com but it doesn't allow me to ssh into this server.
Has anyone experienced this issue? I am almost sure that my connection is set up correctly because if it didn't establish connection it would give me an access error with message `using password "yes". I've read on forums a bit, they suggest installing a mysql server on the same server as the flask application, but I don't have access to sude for some reason, probably due to my cheap plan. Any ideas?
If you are using the MySQL database provided by PythonAnywhere, with the hostname secret_username.mysql.pythonanywhere-services.com, then your database will be called secret_username$test, not just test -- see the "Databases" page on the PythonAnywhere website.

SQLSTATE[HY000] [2002] Cannot assign requested address: how to increase the limit

We're using Lampp stack, PHP PDO, centos 7, MySQL 8. The database server and the MySQL server are different.
On long operations like file uploading, I get
SQLSTATE[HY000] [2002] Cannot assign requested address
Per this answer, I tried making the PDO connection persistent, didn't fix it. the other answer suggests increasing max open files in /etc/security/limits.conf but I didn't find that option in that file.
How to fix that error? does editing that file or any file requires a server restart? Because it's a production server, I need to notify the team should any of the solution require a server restart

mysql on ec2 amazon instance attempting to login with incorrect user

I've set up a very basic LAMP setup on an ec2 server, all good it seems to work.
However i've seen for some queries a failure to connect to the mysql server with the following error:
[07-Jul-2013 20:15:41 Australia/Sydney] PHP Warning: mysql_real_escape_string(): Access denied for user 'ec2-user'#'localhost' (using password: NO) in /var/www/html/mycobber/class/sql/SqlQuery.class.php on line 40
[07-Jul-2013 20:15:41 Australia/Sydney] PHP Warning: mysql_real_escape_string(): A link to the server could not be established in /var/www/html/xxx/xxxx/sql/SqlQuery.class.php on line 40
the thing i dont' understand is the fact that in no location in my mysql connection configuration does it specify the user ec2-user. this is the default user when I log onto the unix server. I've set up a separate account to actually run all my processes, i dont' even use the es2-user.
I've looked online and can't see anything to explain this. does anyone have an idea what's going on here. it's not all the time
Your can't call mysql_real_escape_string without having opened a connection with mysql_connect first.
Quoting from the documentation:
A MySQL connection is required before using mysql_real_escape_string() otherwise an error of level E_WARNING is generated, and FALSE is returned.
The error message refers to your default username # localhost because you haven't opened a connection with specific credentials yet - it doesn't know what account details to use.

Connecting Funambol to MySQL on remote host

I am setting up Funambol 8.7 on a Linux host (using Amazon AWS). I need to connect to a MySQL datbase that is hosted on a different server.
Per the administration guide I went ahead and downloaded the mysql connector and placed the jar in /opt/Funambol/tools/jre-1.6.0/lib/ext. I changed the install.properties file as follows:
dbms=mysql
jdbc.classpath=/opt/Funambol/tools/jre-1.6.0/jre/lib/ext/mysql-connector-java-5.1.14-bin.jar
jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://myserver.net/rugcutte_funambol?characterEncoding=UTF-8
jdbc.user=rugcutte_funambo
jdbc.password=funambol
THen I try to run the install, but get the following error:
/opt/Funambol/ds-server/install/install.xml:452: java.sql.SQLException: Access denied for user 'rugcutte_funambo'#'ec2-50-16-233-200.compute-1.amazonaws.com' (using password: YES)
It appears my AWS instance can connect successfully to my MySQL database however it is trying to login with a fully qualified user name that is incorrect: rugcutte_funambo'#'ec2-50-16-233-200.compute-1.amazonaws.com
I tried also to change the line to : jdbc.user=rugcutte_funambo#myserver.net . But I got a similar error with that as well.
I am relatively inexperienced to JDBC. What is the proper way to set up this section of the install.properties file?
Did you enable access to that database with that user from that server?
What happens if you try and just make the same mysql connection from the command line from your Funambol server?
Thanks Adam.
You led me to the correct answer. The remote host has an area in cPanel to configure Remote Database Access Hosts. So I did, need to add my source host that is running Funambol, to my list of access hosts.
After this I ran the install and it did, appear to create the tables properly in the database running on my remote host.

access denied when trying to connect to mysql using tomcat datasource

I'm trying to connect locally to mysql 5 server in jsp page using tomcat 6 and datasource.
I've configured everything as in the tomcat manual (web.xml, context.xml, etc.), but I get this exception:
java.net.SocketException: java.security.AccessControlException: access denied (java.net.SocketPermission 127.0.0.1:3306 connect,resolve)
I checked the mysql and there is no problem with the connection itself, in fact I even succeeded connecting using direct JDBC connection (i.e. without using datasource).
Do I need to set anything in the tomcat policy file? other ideas?
Thanks
I found a workaround, though I don't like it because I don't understand why it isn't mentioned anywhere, and why the permissions for the connector is not enough?
Can anyone explain me?
The workaround - add these lines to your tomcat policy file:
grant {
permission java.net.SocketPermission "localhost:3306", "connect, resolve";
};