Page 1 of 2

localhost address

PostPosted: 07. January 2019 14:46
by hughstl
I've installed xampp and got Apache and MySQL running, created a database in phpMyAdmin. All good.

When I call my script's setup file it asks for the database connection details.... but adding 'localhost' for the server just gets a red "Database Connection Error" flag.

???

What is the correct address for the server?

Thanks
Hugh

Re: localhost address

PostPosted: 07. January 2019 17:44
by Altrea
Hi,

If you did not change anything localhost is correct or 127.0.0.1.
If you changed the Mysql default port you need to tell your script the new port too.
And you need to use a valid credential combination (user root without a password by default)

Best wishes,
Altrea

Re: localhost address

PostPosted: 07. January 2019 18:52
by hughstl
Hi Altrea, thanks for reply.

No, I didn't change anything - I just installed XAMPP, created a database via the phpMyAdmin, opened browser and called my script...which opens a 'setup' page with fields to enter database connection info.

First field is server name, so entered 'localhost' - immediately flagged up as database connection error, even before I got to the user/password fields! I'd post a screenshot but can't attach image, it seems.

Hugh

Re: localhost address

PostPosted: 07. January 2019 18:57
by Altrea
Uploading files is disabled here but you can use one of many one click image hostes and include the image url here.
But it seems to be an application issue. Phpmyadmin itself connects to the database too by localhost, root and without a password.

Re: localhost address

PostPosted: 07. January 2019 19:18
by hughstl
It's an older version of an application, and I think it's looking for MySQL. From what I can tell from the php.ini (and I've very limited knowledge!) PHP7 seems to support MySQLi and MySQLND

Might have to roll back to an earlier version of PHP, perhaps?...

Re: localhost address

PostPosted: 07. January 2019 19:26
by Altrea
I don't know. I don't know your application and it's requirements.

Re: localhost address

PostPosted: 07. January 2019 19:41
by hughstl
Well nor do I for that matter! It's an older version (5.12) of Appgini, CRUD generator.

The author has advised: "AppGini 5.12 used an older library for connecting to mysql .. this library was removed from more recent versions of PHP".... and ...."try opening the php.ini file in a text editor and search for a line containing “php_mysql” .. if this line is commented, try uncommenting it and restarting Apache. Support for mysql might be there in your installed PHP version but not enabled."

Might have to dig around for an older PHP version - not sure what libraries come with XAMPP or whether there's an easy 'button' to click to initiate older version?...

Re: localhost address

PostPosted: 07. January 2019 19:58
by Altrea
Yes, this old Mysql API was removed since PHP 7.0, so you would need a PHP version 5.6.X or older.

Re: localhost address

PostPosted: 07. January 2019 20:18
by hughstl
Is there a way to switch to an older version of PHP without having to write code into files? Can I throw a switch somewhere?

Re: localhost address

PostPosted: 07. January 2019 21:23
by Altrea
No. The easiest way is uninstalling XAMPP completely and reinstalling an older xampp version.

Re: localhost address

PostPosted: 07. January 2019 21:28
by Nobbie
hughstl wrote:Is there a way to switch to an older version of PHP without having to write code into files? Can I throw a switch somewhere?


No, not a switch. But you can download and install the Xampp Version 5.x from the Download site, this comes with MySQL-API. De-install your current Xampp before.

Re: localhost address

PostPosted: 07. January 2019 22:53
by hughstl
Thanks, guys, I'll remove the install and download the 5 version.

cheers

Re: localhost address

PostPosted: 15. January 2019 00:04
by hughstl
Finally got around to replacing with an older XAMPP distro - 5.6.39 to be precise. Installed ok, opened the control panel, raised phpMyAdmin and created a db, imported sql into db...all went swimmingly. Moved all the site files into htdocs.

Finally called the site... localhost/muludb

Nothing. Except error message: "Error:Access denied for user 'root'@localhost (using password:YES)"

So, still stumped! Any ideas?

Re: localhost address

PostPosted: 15. January 2019 06:30
by Altrea
The default installation does not have a password for MariaDB user root.
But your application seems to expect one.

Re: localhost address

PostPosted: 15. January 2019 12:50
by Nobbie
The application "muludb" obviously uses "root" plus a password in order to connect to MySQL, but Xampp comes with "root" and WITHOUT password. You have to change that in "muludb".