Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+3 votes
1.2k views
in Q2A Core by
edited by
Hello!

I need to set not default port for MySQL. How can I do this in config?
Q2A version: 1.7

2 Answers

+2 votes
by
selected by
 
Best answer

I've updated Q2A to allow setting a port. You will need to add this in qa-config.php

define('QA_MYSQL_PORT', '3306');

This will be part of 1.7.2, due for release next week.

+2 votes
by

This may be the problem of V1.7 core. Until V1.6 database connection was standard mysql_connect, but it was changed to mysqli_connect in V1.7. In case of mysql_connect, port is included in host name. Therefore, you could set port at QA_MYSQL_HOSTNAME of qa-config.php (e.g. 127.0.0.1:3306). However, that setting is not possible in now V1.7.

Solution 1 (Setting example):

Change "mysqli.default_port" from 3306 to 3307 etc in your php.ini. If another program on same server is using the default port, you can not use this method.

Solution 2 (Hack example):

Change L64 - L66 in qa-include/qa-db.php

$db = new mysqli('p:'.QA_FINAL_MYSQL_HOSTNAME, QA_FINAL_MYSQL_USERNAME, QA_FINAL_MYSQL_PASSWORD, QA_FINAL_MYSQL_DATABASE, 3307);
else
$db = new mysqli(QA_FINAL_MYSQL_HOSTNAME, QA_FINAL_MYSQL_USERNAME, QA_FINAL_MYSQL_PASSWORD, QA_FINAL_MYSQL_DATABASE, 3307);

I think core developers need to fix this problem.

 

by
Big thanks ! This option is necessary when installing q2a on computer.
...