• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

AAC (Znote acc) Failed to connect to MySQL: (2005) Unknown MySQL server host

majsters

New Member
Joined
Jun 7, 2010
Messages
18
Reaction score
1
Hello
My znote can't connet to database on a port other than 3306. I changed ports (2x) in etc/mysql/my.cnf.

(engine/database/connect.php)

$connect = new mysqli($config['sqlHost'], $config['sqlUser'], $config['sqlPassword'], $config['sqlDatabase']);

This works perfectly in port 3306


$connect = new mysqli(['xx.xx.xx.xx:3309'], $config['sqlUser'], $config['sqlPassword'], $config['sqlDatabase']);

It probably works but I see:

string(91) "SELECT `id`, `name`, `password`, `email`, `premdays` FROM `accounts` WHERE `id` = LIMIT 1;"
(query - SQL error)
Type: select_single (select single row from database)

who has the idea? :mad:
 
What is the error text below "Type: select_single"?

You configure the host here:
Znote/ZnoteAAC

What TFS version is your server based on?
What client are you using?
 
I only see it:
string(91) "SELECT `id`, `name`, `password`, `email`, `premdays` FROM `accounts` WHERE `id` = LIMIT 1;"
(query - SQL error)
Type: select_single (select single row from database)

i use the newest acc from your github. tfs 1.3. debian 8. firewall disabled
on port 3306 it works perfectly

$config['sqlHost'] = 'xx.xx.xx.xx:MYNEWPORT'; <-- still not work : /
 
bump, how can I cannect an external database with port other than 3306? My website can't connect - it is on whitelist. I suppose the problem is custom port.

tfs 1.3, config.php is configured well.
 
www gets the port and host mysql from the server config.lua

Lua:
-- MySQL
mysqlHost = "127.0.0.1"
mysqlUser = "forgottenserver"
mysqlPass = ""
mysqlDatabase = "forgottenserver"
mysqlPort = 3306
mysqlSock = ""
 
My config.lua is set up properly, a server is running. btw if the acc takes info from config.lua then why bother changing anything in config.php in znote?
 
Exactly, however, there is no port to change in config.php to connect my database. Correct me if Im wrong, youre saying that znote will somehow use a port from config.lua?
 
BUMP

Website shows error: Failed to connect to MySQL: (2002) Connection refused
Im out of ideas how to connect the databse from my website. Both server and domain are on whitelist in my database, server is up and running.
Database is on ovh and domain and www hosting is on hitme.
Here's my config.lua and config.php
lua:
Lua:
mysqlHost = "xxx.ovh.net"
mysqlUser = "dawid"
mysqlPass = "password"
mysqlDatabase = "new"
mysqlPort = 35259
mysqlSock = ""
php:
PHP:
    $config['sqlUser'] = 'dawid';

    // phpmyadmin password for OT server:
    $config['sqlPassword'] = 'password';

    // The database name to connect to. (This is usually same as username).
    $config['sqlDatabase'] = 'new';

    // Hostname is usually localhost or 127.0.0.1.
    $config['sqlHost'] = 'xxx.ovh.net';

Any ideas what Im doing wrong?
PS. what direction should I put in znote if my tfs is on different vps than website? Should I import the config to the website hosting and link the direction?
 
Last edited:
--SOLVED--
engine->database->connect.php
in
PHP:
$connect = new mysqli
add
PHP:
$config['sqlPort'],
then in config.php look for
PHP:
$config['sqlHost']
and add
PHP:
$config['sqlPort'] = 'yourport';
 

Similar threads

Back
Top