WebSite X5Help Center

 
Mark M.
Mark M.
User

Database settings  en

Autor: Mark M.
Visitado 87, Seguidores 1, Compartilhado 0  

Hi,

I have been remaking a project and have got a problem when trying to upload it.

I corrected all the upload setting with the new ftp settings needed along with the database settings.

I also checked the database was working ok, but keep on getting an error when trying to upload.

I also tried using the following MySQLi-extension code (with the password in the code) pasted into PHP script to establish a database connection.

<?php

  $host_name = 'db407648368.db.1and1.com';

  $database = 'db407648368';

  $user_name = 'dbo407648368';

  $password = '<Enter your password here.>';

  $link = new mysqli($host_name, $user_name, $password, $database);

  if ($link->connect_error) {

    die('<p>Failed to connect to MySQL: '. $link->connect_error .'</p>');

  } else {

    echo '<p>Connection to MySQL server successfully established.</p>';

  }

?>

But I must admit I'm not sure where it should go so I tried pasting it in several places with no luck…

Any ideas on a where I am going wrong?

Thanks,

Mark

Publicado em
6 RESPOSTAS
Incomedia
Eric C.
Incomedia

Hello Mark,
in the Data Management section could you please try using localhost as the host name in the Data Management section instead of b407648368.db.1and1.com?

Eric

Ler mais
Publicado em de Eric C.
Mark M.
Mark M.
User
Autor

Hi Eric,

That is one of the things I did try before I tried with the additional code, although I have to admit I'm not to sure where to stick the extra code as I have never had the database problem with the old version of the website; I tried several places but never tried localhost in that code...

Mark

Ler mais
Publicado em de Mark M.
Incomedia
Eric C.
Incomedia

Hello Mark,
I was referring to using it in the Data Management settings, as it is not be necessary to set up any code to allow database connection.
Could you please check your PHP version, making sure it is 8.2, and review all database parameters on your hosting control panel, then delete and add them all again in your project, trying with localhost?

Eric

Ler mais
Publicado em de Eric C.
Mark M.
Mark M.
User
Autor

Hi Eric,

I did use it in the data management settings before I thought about trying some extra code.

Just checked my PHP and it is still 8.1 - despite me changing it to 8.3 last week..!!

I've just changed it again for all my domains so hopefully it might work this time, I'll let you know shortly.

Mark

Ler mais
Publicado em de Mark M.
Mark M.
Mark M.
User
Autor

I changed the PHP with no effect on the error.

I also have just cleared the server dns as well as flushing my local dns, and removed and re-connected the webspace.

This fixed my overlay menu issue, but I still have the database connection issue!

Thanks,

Mark

Ler mais
Publicado em de Mark M.
Mark M.
Mark M.
User
Autor

Hi Eric,

I have just got the database to work by creating a completely new database and also using the host name rather than localhost.

The new database was made with MySQL 8.0 the previous one was actually created with MySQL 5.7 which probably caused the problem, athough it didn't work using localhost as the host name...

Mark

Ler mais
Publicado em de Mark M.