News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Cannot Connect to the Database server with supplied data?

Started by xbilliex, January 12, 2021, 03:16:16 AM

Previous topic - Next topic

xbilliex

So I've got a Synology NAS. I've been trying to set up SMF for the last few hours but it just refuses to work. I've got AdminPHP and MariaDB 10 installed and I've created the root user in AdminPHP with the correct permissions and I created the smf database. Everything is self hosted so when prompted I type localhost for the server and provide the username and password that I use to login to AdminPHP .

I'm just not sure what I'm doing wrong? I've even tried putting in my username and password for the Synology/FTP server itself. I don't know if it matters but I have Apache 7.2 and PHP 5.6. Does anyone have a similar NAS setup who's experienced this problem and maybe knows how to fix it?

Aleksi "Lex" Kilpinen

Where exactly do you get the error? Please describe the actual steps leading to the error.
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF


xbilliex

Oh, sorry, it's during the database configuration step of the install process. I'll add a picture of the screen I'm stuck on. Note that the username that I'm using is my FTP username in the screenshot but I've tried my login for MariaDB because I'm pretty sure that's the right login information since that's the login information I use to actually see the smf database I created.

I guess what I'm asking is: is the problem my logon information or is it something else? Because I check the user I created for PHPMyAdmin and it says that it has the right permissions for all databases. Also, I check and in PHPMyAdmin the user is listed as "root@localhost" so I'm guessing that the host I've listed is correct as well? Also where is the log? Honestly, if I had a better idea of what the exact problem was I feel like I could fix it much easier.

Sorry if I'm not making much sense. I've read a lot of the help forums here for this issue already and I'm trying to make sure give all the relevant information. Thanks! : )

Aleksi "Lex" Kilpinen

Okay, yes - the username and pw should be the Database user's. Is the database server actually on localhost? Where is your webserver running, is it on the same device as the database server?
If you are running the installer from your computer on localhost, and the database server is actually running on another device, then the address for the database server probably is not localhost.
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

xbilliex

Yes, the database server is on the same machine as the forum. Now when you ask if I'm running the installer on my computer, I am running the installer on my Windows computer but the files for the installer are on the NAS. So does that count? If it isn't localhost where would I find it? I've checked PHPMyAdmin but it lists the server as being MariaDB 10. Would the server be that?

Aleksi "Lex" Kilpinen

The actual location of the files doesn't really matter as much, but the the device running the DB service, and webserver service do matter.
Localhost is basically same as saying "this machine", or typing 127.0.0.1

If the webserver and database server are both running on the same machine, then localhost should generally be ok.
If the database server is on another machine, then you would probably need an IP address for that machine, and possibly a port number as well.
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

GigaWatt

Instead of "localhost", try "127.0.0.1" ;) (home sweet home ;D).
"This is really a generic concept about human thinking - when faced with large tasks we're naturally inclined to try to break them down into a bunch of smaller tasks that together make up the whole."

"A 500 error loosely translates to the webserver saying, "WTF?"..."

xbilliex

I tried 127.0.0.1 and it didn't seem to like that either (Screenshot attached) but at least I'm learning that the issue isn't the login information I'm supplying. If the database and the web server are on the same machines, I'm logging on with the correct info that I use to logon to PHPMyAdmin, then that would mean that the issue can't be the the username, password, or server name? I mean unless the installer just can't "see" the database even though I'm supplying the right credentials.

Good news is that we're narrowing down the problem at least. Thoughts?

GigaWatt

OK... try this (copy/paste in text editor, change extension to .php and upload in root directory, where index.php resides).


<?php
$servername
= "localhost";
$database = "database";
$username = "user";
$password = "password";

// Create connection
$conn = new mysqli($servername, $username, $password, $database);
// Check connection
if ($conn->connect_error) {
  die(
"Connection failed: " . $conn->connect_error);
}
 echo
"Connected successfully";
?>


Change $servername, $database, $username and $password to the appropriate values.
"This is really a generic concept about human thinking - when faced with large tasks we're naturally inclined to try to break them down into a bunch of smaller tasks that together make up the whole."

"A 500 error loosely translates to the webserver saying, "WTF?"..."

xbilliex

"Connection failed: No such file or directory"

I used the same log on info that I did the last time. Localhost, smf, root, and same password. I can get into MariaDB so I know the username and password are right and I created the smf database there. I guess the problem has to be when I try to locate the server as localhost or 127.0.0.1? Thanks for helping me out by the way. I hope we can get this figured out.

Sir Osis of Liver

Does phpmyadmin load the database?  What is it showing for database server?
When in Emor, do as the Snamors.
                              - D. Lister

xbilliex

MariaDB and yes. I mean, at least I think that's what the server is called. I attached a photo of the database and what PHPmyadmin says the server name is.

Illori

the top item you highlighted is not the name of the server it is name of the type of database you are using. if you did not set the server details in phpmyadmin then you are using localhost most likely.

IMO if you cannot get this to work you should not host a webserver on your machine.

xbilliex

Yes, I know that's the name of the type of database I'm using. I was reading a tutorial earlier though and I know that other people have 127.0.0.1 listed after server which is what you write in server. Also, I'm not sure what you mean, I know you can host a forum off of Synology NAS because I've seen it done.

Do you mean that I can't or I shouldn't? And if I shouldn't, why not?

Illori

if you dont know how to connect to the database, then i will assume you dont know how to make your webserver secure and keep hackers away. you dont want your forum hacked.

xbilliex

Um, okay. Two things: It's for me a like six other people who I all personally know and I won't be advertising it anywhere. Also I obviously followed all of the directions point for point otherwise there would have been an easy fix since I had people who know more about this software helping me install. If the people help forum even seem a little stumped then it seems like it might not be my fault.

Be honest, are you really that worried about hackers or do you just not know how to fix the problem and don't want to admit it?  ;)

xbilliex

Sorry to double post!

I just wanted to say I solved the issue. Thanks to everyone who was helpful. It turns out that the version of MariaDB (MariaDB 10) wasn't functioning correctly. I installed MariaDB 5 created a new database and it worked. It turned out I'd been doing everything correctly but for what ever reason MariaDB 10 just wasn't having it.  ;D

Thanks for all the help guys!

Aleksi "Lex" Kilpinen

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

Advertisement: