skip to Main Content

Trying to connect to a mysql db on a raspberry pi, from a Synology NAS.

The SELECT shows nothing, and the connect.php shows no errors.

Both work fine from a different Pi to the host Pi.

I’ve tried with an existing user in phpmyadmin, and with another, new user.
both have %, all IP LAN access.

<?php
 $db = mysqli_connect(host='192.168.1.41','user','passwd','dbase')
 or die('Error connecting to MySQL server.');
?>

<html>
<!-- This is a comment -->
 <head>
 </head>
 <body>
 <h6>PHP connected</h6>
 <!-- <h6>PHP connected</h6> --> 
 </body>

Also tried with:

(host='192.168.1.41',database='dbase',user='user',password='passwd')

I can’t see why I get neither error messages, or select query results.

2

Answers


  1. Chosen as BEST ANSWER

    I found a fix for this, here
    You just have to enable the mysqli extension on the Synology 'Web Station' plug-in.


  2. try to add mysql or mariadb port number to your hostname

    $db = mysqli_connect(host='192.168.1.41:3307','user','passwd','dbase')
    or die('Error connecting to MySQL server.');
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search