bfabiszewski / ulogger-server

μlogger • web viewer for tracks uploaded with μlogger mobile client
GNU General Public License v3.0
518 stars 84 forks source link

I am unable to figure out how to setup the required data source name in ulogger #211

Closed chasjager closed 1 year ago

chasjager commented 1 year ago

I am not a programmer, andI have previously installed ulogger and had it run successfully... years ago. Now, though, I am stuck at this message, which appears in my browser after I go to mysite/ulogger/scripts.php.

µLoggerWelcome to µlogger!

Database connection

failed.

Please check database settings in 'config.php' file.

Server said: invalid data source name

Please restart this script when you are done.

Is there something in the lines below, from config.php, that I should change?

// PDO data source name, eg.: // mysql:host=localhost;port=3307;dbname=ulogger;charset=utf8 // mysql:unix_socket=/path/to/mysql.sock;dbname=ulogger;charset=utf8 // pgsql:host=localhost;port=5432;dbname=ulogger // sqlite:/path/to/ulogger.db

I have tried modifying one line as follows

`` $PDO = "mysql:host=localhost;port=3307;dbname=ulogger;charset=utf8";

to no avail.

I welcome any guidance forthcoming.

bfabiszewski commented 1 year ago

There are only four places where you should fill in missing information. You must enter strings between quotation marks that are now empty.

// PDO data source name, eg.:
$dbdsn = "";
// Database user name
$dbuser = "";
// Database user password
$dbpass = "";
// Optional table names prefix, eg. "ulogger_"
$dbprefix = "";

The first one ($dbdsn) holds your database configuration. The string must be in a format accepted by PDO driver. It depends on the database type you use and the database setup. I gave some examples in the file. For example mysql:host=localhost;port=3306;dbname=ulogger;charset=utf8 is for MySQL database running on local host on port 3306 where database name is ulogger. The next ones ($dbuser and $dbpass) are your database user name and password. The last one ($dbprefix) is optional and you most probably won't need it.

So after your edit the file might look like this:

// PDO data source name, eg.:
$dbdsn = "mysql:host=localhost;port=3306;dbname=ulogger;charset=utf8";
// Database user name
$dbuser = "yourname";
// Database user password
$dbpass = "yourpassword";
// Optional table names prefix, eg. "ulogger_"
$dbprefix = "";
chasjager commented 1 year ago

Aha! Yes, I had set $dbdsn = "ulogger", not recalling that it should have been set as you said. I had set the other variables correctly.

Thank you.