<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[FrontAccounting forum — Setup DB Connection Error]]></title>
		<link>https://frontaccounting.com/punbb/viewtopic.php?id=7442</link>
		<atom:link href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=7442&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Setup DB Connection Error.]]></description>
		<lastBuildDate>Fri, 22 Oct 2021 18:25:38 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Setup DB Connection Error]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=40134#p40134</link>
			<description><![CDATA[<p>Did not find the issue reported in Mantis, so I created an entry there.</p>]]></description>
			<author><![CDATA[null@example.com (bobloblian)]]></author>
			<pubDate>Fri, 22 Oct 2021 18:25:38 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=40134#p40134</guid>
		</item>
		<item>
			<title><![CDATA[Re: Setup DB Connection Error]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=40133#p40133</link>
			<description><![CDATA[<p>Hi Folks, </p><p>Kudos to guabeff and gnurob; on a fresh install of 2.4.10, I can confirm that both situations are correct; password must be less than 21 characters long, *and* must not contain an ampersand.&nbsp; Did not test other special characters, I just removed them all from the password, and got by that screen.</p>]]></description>
			<author><![CDATA[null@example.com (bobloblian)]]></author>
			<pubDate>Fri, 22 Oct 2021 18:17:32 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=40133#p40133</guid>
		</item>
		<item>
			<title><![CDATA[Re: Setup DB Connection Error]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=39313#p39313</link>
			<description><![CDATA[<div class="quotebox"><cite>RedCone wrote:</cite><blockquote><p>I get the following error messages when trying to connect to the db:<br />mysqli_connect(): (HY000/1045): Access denied for user &#039;root&#039;@&#039;localhost&#039; (using password: YES) in file: /var/www/html/includes/db/connect_db_mysqli.inc at line 206<br />mysqli_select_db() expects parameter 1 to be mysqli, boolean given in file: /var/www/html/includes/db/connect_db_mysqli.inc at line 208<br />mysqli_query() expects parameter 1 to be mysqli, boolean given in file: /var/www/html/includes/db/connect_db_mysqli.inc at line 213<br />Cannot connect to database. User or password is invalid or you have no permittions to create database.</p><p>I have read every thread I have found, but nothing seems to address this issue. One post suggested issues with PHP7, so I added a modification to revert back to PHP5.6. This did not make any difference. I&#039;ve also read threads suggesting changes to the connect_db_mysqli.inc file, but my file already seems to include the proposed changes.</p><p>I&#039;ve had no problem accessing MySQL via SSH, so I know it&#039;s running. Am I missing something obvious? Oh, and I&#039;m using Ubuntu 16.04</p><p>Hoping for a solution...</p></blockquote></div><p>I tried to install FA on a Synology NAS system.&nbsp; Got stuck with exactly the same error messages, and done everything that I found in posts etc.&nbsp; The NAS uses Maria DB (v10).&nbsp; My solution was to set the MariaDB FTP option and then do the installation with the server being 127.0.0.1:3307, where 3307 is the default port number for ftp connections to the database.</p>]]></description>
			<author><![CDATA[null@example.com (flyguy)]]></author>
			<pubDate>Mon, 29 Mar 2021 21:06:18 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=39313#p39313</guid>
		</item>
		<item>
			<title><![CDATA[Re: Setup DB Connection Error]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=38816#p38816</link>
			<description><![CDATA[<p>MySQL host, username, password length restrictions in MySQL 5.5.36 is 60, 16 and 41 respectively but consider the real password length to be less as hashing payload exists. Do not directly try to change the field sizes of the various tables in the mysql db.</p><p>MySQL uses <strong>PASSWORD(str)</strong> to encrypt the cleartext password <strong>str</strong>. This hashed password string is stored in the <em>mysql.user</em> grant table with a <strong>CHAR(41)</strong> datatype. </p><p>Refer:<br />https://dev.mysql.com/doc/refman/5.7/en/user-names.html<br />https://stackoverflow.com/questions/7465204/maximum-mysql-user-password-length</p><p>The file <strong>create_coy.php</strong> in lines 331-335 has these size limits:<br /></p><div class="codebox"><pre><code>        text_row_ex(_(&quot;Host&quot;), &#039;host&#039;, 30, 60);
        text_row_ex(_(&quot;Port&quot;), &#039;port&#039;, 30, 60);
        text_row_ex(_(&quot;Database User&quot;), &#039;dbuser&#039;, 30);
        text_row_ex(_(&quot;Database Password&quot;), &#039;dbpassword&#039;, 30);
        text_row_ex(_(&quot;Database Name&quot;), &#039;dbname&#039;, 30);</code></pre></div><p>If such size limitations exist as indicated by the findings in this thread, then these sizes should be enforced here.</p>]]></description>
			<author><![CDATA[null@example.com (apmuthu)]]></author>
			<pubDate>Wed, 23 Dec 2020 17:02:35 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=38816#p38816</guid>
		</item>
		<item>
			<title><![CDATA[Re: Setup DB Connection Error]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=38810#p38810</link>
			<description><![CDATA[<p>Thank you guabeff. Good testing.</p><p>Continuing on this. I checked my password: only 10 characters. However, it contained an ampersand. On a hunch I replaced &quot;&amp;&quot; with &quot;a&quot; and everything works. There is obviously some string sanitation going on that&#039;s breaking passwords (only enough, manually entering port 3306 will partially bypass it).</p><p>I replaced the &quot;&amp;&quot; character with the letter &quot;a&quot;, in my 10 character password, and everything works--it was only 10 characters.</p>]]></description>
			<author><![CDATA[null@example.com (gnurob)]]></author>
			<pubDate>Tue, 22 Dec 2020 18:33:41 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=38810#p38810</guid>
		</item>
		<item>
			<title><![CDATA[Re: Setup DB Connection Error]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=38809#p38809</link>
			<description><![CDATA[<p>Testing further i think i Just got the root of the problem, indeed there is something wrong with the file connect_db_mysqli.inc as gnurob mentioned, when you use a password on the user database that is 21 or more characters long this script fail in the setup, a password less than 21 character will connect successfully go to next steps and install the application. </p><br /><p>I could prove that is the script failing and not the database, because i also test hardcoding the password&nbsp; in the line 205 of the file connect_db_mysqli.inc, If you hardcode the password and run the setup no matter if&nbsp; password is 21 o more characters long it will succeed. </p><p>I change this line</p><p>&nbsp; $db = mysqli_connect($connection[&quot;host&quot;], $connection[&quot;dbuser&quot;], $connection[&quot;dbpassword&quot;], &quot;&quot;,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; !empty($connection[&quot;port&quot;]) ? $connection[&quot;port&quot;] : 3306); // default port in mysql is 3306</p><p>For this line</p><p>$db = mysqli_connect($connection[&quot;host&quot;], $connection[&quot;dbuser&quot;], &quot;your_hard_code_pass_here&quot;, &quot;&quot;,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; !empty($connection[&quot;port&quot;]) ? $connection[&quot;port&quot;] : 3306); // default port in mysql is 3306</p><p>So in conclusion:<br /> - There is something wrong in the logic of the code on the file connect_db_mysqli.inc at line 205 (db_create_db function), that is not passing the correct password to the database if password is 21 characters or more. </p><p>Workaround:<br />- Use a password less than 21 characters for the database user. </p><p>Hope this is could help, and some of the developers can test, confirm and fix this issue</p>]]></description>
			<author><![CDATA[null@example.com (guabeff)]]></author>
			<pubDate>Tue, 22 Dec 2020 18:21:01 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=38809#p38809</guid>
		</item>
		<item>
			<title><![CDATA[Re: Setup DB Connection Error]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=38807#p38807</link>
			<description><![CDATA[<div class="quotebox"><cite>kvvaradha wrote:</cite><blockquote><p>Your mariadb port no is different. Guess your hosting provider is using different port no for mariadb. Check with them to get it. Usually most of the MySql server configured with 3306.&nbsp; And some servers they might changed port no for some other apps. So you have to get right port no for your mariadb and input here. With right port no, it will work.</p></blockquote></div><p>It&#039;s my server on a rack 2 m to my left. Default port, 3306. This also doesn&#039;t explain why adding 3306 will get past the first database login to a confirmation screen, only to fail and loop back to the database login screen. Something is amiss.</p>]]></description>
			<author><![CDATA[null@example.com (gnurob)]]></author>
			<pubDate>Tue, 22 Dec 2020 05:53:41 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=38807#p38807</guid>
		</item>
		<item>
			<title><![CDATA[Re: Setup DB Connection Error]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=38806#p38806</link>
			<description><![CDATA[<p>Still no solution, but perhaps this will save someone else a few steps.</p><p>I have a similar setup running correctly on another Apache server that ran FrontAccounting 2.4.6 on PHP versions 7.1 up to 7.4. It may have been installed on PHP 5.6, and later upgraded. I can no longer recall for certain but I believe it was installed on PHP 7.1.</p><p>Both databases are local to the server and have the exact same privileges, database names, etc.</p><p>MariaDB [(none)]&gt; show grants for username@&#039;localhost&#039;;<br />GRANT USAGE ON *.* TO &#039;username&#039;@&#039;localhost&#039; IDENTIFIED BY PASSWORD &#039;******&#039;<br />GRANT ALL PRIVILEGES ON `username`.* TO &#039;username&#039;@&#039;localhost&#039; </p><p>I took a look at changes in the code and found nothing significant in the following three files:</p><div class="codebox"><pre><code>$ diff frontaccounting-2.4.9/includes/db/connect_db_mysqli.inc frontaccounting-2.4.6/includes/db/connect_db_mysqli.inc 
13c13
&lt; define(&#039;SQL_MODE&#039;, &#039;STRICT_ALL_TABLES&#039;); // prevents SQL injection with silent field content truncation
---
&gt; define(&#039;SQL_MODE&#039;, &#039;&#039;); // STRICT_ALL_TABLES,NO_ZERO_IN_DATE ?

$ diff frontaccounting-2.4.9/includes/db/connect_db.inc frontaccounting-2.4.6/includes/db/connect_db.inc 
(no change)

$ diff frontaccounting-2.4.9/install/index.php frontaccounting-2.4.6/install/index.php
(no change)</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (gnurob)]]></author>
			<pubDate>Tue, 22 Dec 2020 05:27:16 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=38806#p38806</guid>
		</item>
		<item>
			<title><![CDATA[Re: Setup DB Connection Error]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=38805#p38805</link>
			<description><![CDATA[<p>Your mariadb port no is different. Guess your hosting provider is using different port no for mariadb. Check with them to get it. Usually most of the MySql server configured with 3306.&nbsp; And some servers they might changed port no for some other apps. So you have to get right port no for your mariadb and input here. With right port no, it will work.</p>]]></description>
			<author><![CDATA[null@example.com (kvvaradha)]]></author>
			<pubDate>Tue, 22 Dec 2020 05:04:07 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=38805#p38805</guid>
		</item>
		<item>
			<title><![CDATA[Re: Setup DB Connection Error]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=38804#p38804</link>
			<description><![CDATA[<p>I spoke too soon.</p><p>Adding 3306 does allow the installation to proceed to the next screen. The following message is displayed:</p><p>&quot;All application preliminary requirements seems to be correct. Please press Continue button below.&quot;</p><p>However, clicking continue returns to the database login, and the same connection parameters no longer work. It is possible to get back to the preliminary requirements confirmation by trying once to login without 3306, and then again with.</p><p>There appears to be a fail in the logic check around the port number.</p>]]></description>
			<author><![CDATA[null@example.com (gnurob)]]></author>
			<pubDate>Tue, 22 Dec 2020 04:49:14 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=38804#p38804</guid>
		</item>
		<item>
			<title><![CDATA[Re: Setup DB Connection Error]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=38803#p38803</link>
			<description><![CDATA[<p>FWIW, me too, and I found the problem. The connection is not using 3306 when it is not specified.</p><p>It looks like it is, but there could be a mistake in this line, or perhaps a non NULL value is being passed by the database connection in the install script.</p><p>&nbsp; &nbsp; &nbsp; &nbsp; $db = mysqli_connect($connection[&quot;host&quot;], $connection[&quot;dbuser&quot;], $connection[&quot;dbpassword&quot;], &quot;&quot;,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; !empty($connection[&quot;port&quot;]) ? $connection[&quot;port&quot;] : 3306); // default port in mysql is 3306</p><p>FrontAccounting 2.4.9<br />PHP 7.3<br />MariaDB 10.3.18</p>]]></description>
			<author><![CDATA[null@example.com (gnurob)]]></author>
			<pubDate>Tue, 22 Dec 2020 04:42:30 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=38803#p38803</guid>
		</item>
		<item>
			<title><![CDATA[Re: Setup DB Connection Error]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=38802#p38802</link>
			<description><![CDATA[<p>Thanks for the response but Is not the database, as you can see the MariaDB logs I pasted, there is a successful connection and the db running. as you can see on the logs i tried on the application install and fail (LOG 96) but using the same credentials i could access to the database correctly BY SSH and mysql client (LOG 97).&nbsp; also installed a wordpress pointing to same database with same credential&nbsp; for testing and no problem with database, also the account have all privileges</p><p>I tried the script kvvaradha posted so long ago to test the db connection and was success, also tried the solution of redcone, but it did not work. So do not have now where to look out, I will appreciate what else i could check out to get the problem solved.</p><br /><p>201221&nbsp; 3:49:05&nbsp; &nbsp; &nbsp;96 Connect&nbsp; fraccdbuser@localhost as anonymous on fraccdb <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 96 Connect&nbsp; Access denied for user &#039;fraccdbuser&#039;@&#039;localhost&#039; (using password: YES) <br />201221&nbsp; 3:49:41&nbsp; &nbsp; &nbsp;97 Connect&nbsp; fraccdbuser@localhost as anonymous on<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 97 Query&nbsp; &nbsp; select @@version_comment limit 1<br />201221&nbsp; 3:49:57&nbsp; &nbsp; &nbsp;97 Query&nbsp; &nbsp; SELECT DATABASE()<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 97 Init DB&nbsp; fraccdb<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 97 Query&nbsp; &nbsp; show databases<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 97 Query&nbsp; &nbsp; show tables<br />201221&nbsp; 3:50:01&nbsp; &nbsp; &nbsp;97 Quit</p>]]></description>
			<author><![CDATA[null@example.com (guabeff)]]></author>
			<pubDate>Tue, 22 Dec 2020 02:58:49 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=38802#p38802</guid>
		</item>
		<item>
			<title><![CDATA[Re: Setup DB Connection Error]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=38798#p38798</link>
			<description><![CDATA[<p>There is problem with connecting your MySql server. Looks like connection credentials wrong or the MySql server is down.</p>]]></description>
			<author><![CDATA[null@example.com (kvvaradha)]]></author>
			<pubDate>Mon, 21 Dec 2020 07:33:43 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=38798#p38798</guid>
		</item>
		<item>
			<title><![CDATA[Re: Setup DB Connection Error]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=38797#p38797</link>
			<description><![CDATA[<p>Also turn the logs ON and i could see the following, the first (96) connect is via the front accounting setup and the second (97) is via ssh by mysql client. </p><p>201221&nbsp; 3:49:05&nbsp; &nbsp; &nbsp;96 Connect&nbsp; fraccdbuser@localhost as anonymous on fraccdb<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 96 Connect&nbsp; Access denied for user &#039;fraccdbuser&#039;@&#039;localhost&#039; (using password: YES)<br />201221&nbsp; 3:49:41&nbsp; &nbsp; &nbsp;97 Connect&nbsp; fraccdbuser@localhost as anonymous on<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 97 Query&nbsp; &nbsp; select @@version_comment limit 1<br />201221&nbsp; 3:49:57&nbsp; &nbsp; &nbsp;97 Query&nbsp; &nbsp; SELECT DATABASE()<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 97 Init DB&nbsp; fraccdb<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 97 Query&nbsp; &nbsp; show databases<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 97 Query&nbsp; &nbsp; show tables<br />201221&nbsp; 3:50:01&nbsp; &nbsp; &nbsp;97 Quit</p>]]></description>
			<author><![CDATA[null@example.com (guabeff)]]></author>
			<pubDate>Mon, 21 Dec 2020 03:53:49 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=38797#p38797</guid>
		</item>
		<item>
			<title><![CDATA[Re: Setup DB Connection Error]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=38796#p38796</link>
			<description><![CDATA[<p>Hello I having the same problem trying to install front accounting i get the errors<br />mysqli_connect(): (HY000/1045): Access denied for user &#039;fraccdbuser&#039;@&#039;localhost&#039; (using password: YES) in file: /var/www/html/fracc/includes/db/connect_db_mysqli.inc at line 206<br />mysqli_select_db() expects parameter 1 to be mysqli, bool given in file: /var/www/html/fracc/includes/db/connect_db_mysqli.inc at line 208<br />mysqli_query() expects parameter 1 to be mysqli, bool given in file: /var/www/html/fracc/includes/db/connect_db_mysqli.inc at line 213<br />Cannot connect to database. User or password is invalid or you have no permitions to create database</p><p>I tested the connection script&nbsp; apmuthu posted and i can successfully connect to the database with the credentials, also can connect with the credentials of fraccdbuse using ssh and use the database and create tables on it, also www-data have all privilege on the web root html folder.<br />Finally i tried to hardcode the database name&nbsp; in the script as apmuthu but is the same errors occurs. </p><p>Using FrontAccounting 2.9</p><p>PHP Version 7.4.3</p><p>installed on Apache<br />Server version: Apache/2.4.41 (Ubuntu)<br />Server built:&nbsp; &nbsp;2020-08-12T19:46:17</p><p>Using MariaDB database<br />Server version: 10.3.25-MariaDB-0ubuntu0.20.04.1 Ubuntu 20.04</p><p>Help appreciated</p>]]></description>
			<author><![CDATA[null@example.com (guabeff)]]></author>
			<pubDate>Mon, 21 Dec 2020 03:19:01 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=38796#p38796</guid>
		</item>
	</channel>
</rss>
