Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
1.6k views
in Q2A Core by
retagged by

Hello,

i have some problems to connect my old data base from old server, to new server form my domain and for Q2A. My domain is now working good, but when im trying to go to Q2A in subcategory ir hows:

 

 

Warning: mysql_connect(): Connection refused in/home/user/domains/mydomain/public_html/questions/qa-include/qa-db.php on line 66

Could not establish database connection. Please check the username, password and hostname in the config file, and if necessary set up the appropriate MySQL user and privileges.

 

 

here is the line 66 on my qa-db.php file:

if (!is_resource($qa_db_connection)) {
if (QA_PERSISTENT_CONN_DB)
$db=mysql_pconnect(QA_FINAL_MYSQL_HOSTNAME, QA_FINAL_MYSQL_USERNAME, QA_FINAL_MYSQL_PASSWORD);
else
$db=mysql_connect(QA_FINAL_MYSQL_HOSTNAME, QA_FINAL_MYSQL_USERNAME, QA_FINAL_MYSQL_PASSWORD);        <--------66
 
 
in my config qa-config.php I wrote everithink right:
 
define('QA_MYSQL_HOSTNAME', '127.0.0.1'); // try '127.0.0.1' or 'localhost' if MySQL on same server
define('QA_MYSQL_USERNAME', 'my main database username');
define('QA_MYSQL_PASSWORD', 'my username password');
define('QA_MYSQL_DATABASE', 'my database name');
 

and in qa-base.php i found few strokes also:

if (defined('QA_FINAL_WORDPRESS_INTEGRATE_PATH')) {
define('QA_FINAL_MYSQL_HOSTNAME', DB_HOST);
define('QA_FINAL_MYSQL_USERNAME', DB_USER);
define('QA_FINAL_MYSQL_PASSWORD', DB_PASSWORD);
define('QA_FINAL_MYSQL_DATABASE', DB_NAME);
define('QA_FINAL_EXTERNAL_USERS', true);
 
Can any one to help me to resolve this problem?
Q2A version: newest
by
It may be necessary to show information below according to old environment and new environment exactly.
1. Environment of your host server (hardware) count
2. Relations of Web server and database server
by
I don't have my old server environment, because it was expired yesterday, i just got all my files from it and databases, and integrated those databases in the new server. I didn't install Q2A on new server, just copyied all files there. What u mean asking about second: 2. Relations of Web server and database server

1 Answer

0 votes
by
Bump.

 

I have the exact same symptoms. Copied files from existing running server, and now new mysql/php/q2a will not connect. Any solution to this?

Do I need to rebuild from scratch, or is there something inherently wrong with copying q2a files from one server to another?

Trying to debug the PHP code at this point. I am a C coder not a PHP coder, so will take some time to learn syntax; so any help would be appreciated.
...