Jump to content

Lasslos05

New Members
  • Posts

    6
  • Joined

  • Last visited

Lasslos05's Achievements

Newbie

Newbie (1/5)

0

Reputation

1

Community Answers

  1. I don't know how, but I solved it. I just tried a random script from the internet that looked a little bit different. It's that one: <?php $user = 'DBu*******'; $pass = '****************'; $host = 'rdbms.strato.de'; $db = 'DBs**********'; $conn = new mysqli($host, $user, $pass, $dbdb); if ($conn->connect_error) { echo("Connection failed: " . $conn->connect_error); } else { echo "Success"; } ?> Thanks so much to all of you who tried to help me.
  2. And btw, I tried to change the PHP Version to 8.0. Now it says SQLSTATE[HY000] [2002] No such file or directory I obviously can change it back but I would appreciate if someone knew a new way in PHP 8.0, mabye that will solve the problem.
  3. Hey Guys, first of all, thank you for the reply's. I taught I would be subscribed to that topic automatically. Apparently, I wasn't. I ran the code of @gizmola exactly how he wrote it except for the error thrown in the catch block, and replaced it with echo $e->getMessage(); I have a good message and a bad message: Good message: It shows something different! Bad message: It's an error. The error is: SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) And if I try it with SSH, as @kicken suggested, it throws: ERROR 2003: (HY000): Can't connect to MySQL server on 'rdbms.webmailer.de' (113) I've tried it twice, and I'm pretty sure there was no typo. I could not find any security settings that could block access.
  4. I don't think so. The tutorial from my hosting service (strato.de) uses mysql_connect($db_server, $db_user, $db_password). If there is a port added automatically when using mysql_, then that could be the issue. The code from the offical tutorial from strato: # Access data $db_server = 'rdbms.strato.de'; $db_user = ''; $db_passwort = ''; $db_name = ''; # Connection establishment if(mysql_connect($db_server, $db_user, $db_password)) { echo 'Server connection successful, select database... '; if(mysql_select_db($db_name)) { echo 'Server connection successful, select database ... } else { echo 'The specified database could not be selected, please check the information you have entered!'; } } else { echo 'Connection not possible, please check data! '; echo 'MYSQL-error: '.mysql_error(); } ?>
  5. Thanks for the reply. I changed the code: <?php $host = 'rdbms.strato.de'; $db = 'DBS*********'; $user = 'DBU******'; $password = '******************'; $dsn = "mysql:host=$host;dbname=$db;charset=UTF8"; try { $db = new PDO($dsn, $user, $password); echo 'connected'; } catch (PDOException $e) { echo $e->getMessage(); } ?> It still doesn't work. Is there something else wrong? I'm pretty sure the login data is correct. Error Message: SQLSTATE[HY000] [2003] Can't connect to MySQL server on 'rdbms.webmailer.de' (113)
  6. Hey Guys, I'm building my own website with flutter. It needs a database, so I set up one on strato.de and tried to set up a php connection. See here: db.lh0.eu/db_connection.php The code: <?php $db_server = 'rdbms.strato.de'; $db_benutzer = 'DBU******'; $db_passwort = '******************'; $db_name = 'DBS********'; # Verbindungsaufbau if(mysql_connect($db_server, $db_benutzer, $db_passwort)) { echo 'Server-Verbindung erfolgreich, wähle Datenbank aus...'; if(mysql_select_db($db_name)) { echo 'Datenbank erfolgreich ausgewält, alle Tests abgeschlossen.'; } else { echo 'Die angegebene Datenbank konnte nicht ausgewählt werden, bitte die Eingabe prüfen!'; } } else { echo 'Verbindung nicht möglich, bitte Daten prüfen! '; echo 'MYSQL-Fehler: '.mysql_error(); } ?> Anything I did wrong? The documentation how to use PHP to access the database is here: https://www.strato-hosting.co.uk/faq/hosting/this-is-how-you-can-use-our-mysql-database/
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.