The MySQL server of the NAS326 app runs only on localhost, how do I make it LAN reachable?

Sivaka
Sivaka Posts: 2  Freshman Member
edited December 2018 in Personal Cloud Storage
Hello, everyone!

I've been trying to configure the MySQL app for my NAS326 for a solid day now and it's getting a little frustrating, so here I am! I need to configure the server so that it accepts requests from the whole local network as opposed to the default localhost option (since the local host is the NAS itself as far as the MySQL server is concerned). Don't see this configuration anywhere in the default settings, so I'm trying to use a phpMyAdmin generated setup script, which fails to import with the descriptive message "Could not import configuration". At this point I'm desperate enough to look for ways to hack into the /i-data/146e8075/.PKG/PHP-MySQL-phpMyAdmin/ folder and configure the config.inc.php script myself.

Thanks in advance, any help or suggestion will be greatly appreciated!

P.S. The MySQL server app was pretty much what leaned me towards the Zyxel NAS in the first place, so I really hope we can get this thing working!

#NAS_Dec_2018

Accepted Solution

  • Ijnrsi
    Ijnrsi Posts: 254  Master Member
    Accepted Answer
    It is sad as NAS was able to access Mysql via LAN, but for some reason that Zyxel block LAN acces and only can through NAS itself.
    Moreover, the mysql command was not included in Zyxel NAS, that no possible to use command "update mysql.user set host='0.0.0.' where user=''" and also could not find the config file for my.conf.
    Therefore, currently I think there is not the way to make it working. 

All Replies

  • JockeSve
    JockeSve Posts: 55  Ally Member
    Might be similar to this:

    On 540/542 the 'bind-address is always restored to defaults (127.0.0.1) when updating/re-installing FW.
    Could be worth a try to check and try with "bind-address=0.0.0.0" 
    (Location: /i-data/ede84c02/.PKG/PHP-MySQL-phpMyAdmin/etc/init.d)

    For some weird reason seems Zyxel people think that the MySQL is for local/internal use only...  
  • Sivaka
    Sivaka Posts: 2  Freshman Member
    Thank you for the answers, guys, it's really a shame that's the current state of things!
  • nintendoeats
    nintendoeats Posts: 4  Freshman Member
    edited June 2020
    For anybody who has this problem, I can haz solution (requires you to set up a static IP).

    Install and enable phpmyadmin. Ensure that the client is closed.
    ssh in to the NAS as root (yes, you must be root)
     
    ps | grep mysql         note the ID of the mysql process
    kill mysqlProcessID
    cd /i-data/LongAlphanumericThatIThinkIsUnique/.PKG/PHP-MySQL-phpMyAdmin/mysql
    ./bin/mysqld_safe --user=mysql --bind-address=Static.IP.address.oftheNAS

    That's it! I wanted to use the SQL server to centralize my Kodi database, and it does that. Performance is obviously limited on such a low-powered box, but hey it was cheap!


  • nintendoeats
    nintendoeats Posts: 4  Freshman Member
    edited June 2020
    For anybody who is still having this problem, I have a solution (requires that your NAS have a static IP address)

    • Install phpmyadmin and enable it (don't open it yet)
    • ssh into your NAS as root (yes, you must be root)
    • ps | grep mysql         note the ID of the mysql process
    • kill mysqlProcessID
    • cd /i-data/LongAlphanumericThatIThinkIsUnique/.PKG/PHP-MySQL-phpMyAdmin/mysql
    • ./bin/mysqld_safe --user=mysql --bind-address=Static.IP.address.oftheNAS
    And there you go! I haven't set this up to happen automatically, but it works fine like this! I'm using it to centralize my kodi database.
  • JockeSve
    JockeSve Posts: 55  Ally Member
    TY @nintendoeats
    Too bad that it runs an ancient MySQL version...  :s 
    An update to more recent version would be magic, ATM I moved out my DB's to RPi instead.
  • nintendoeats
    nintendoeats Posts: 4  Freshman Member
    How can I put this...the MySQL server you have with you is the better than the MySQL server on an RPi that's still in the box in China :p
  • JockeSve
    JockeSve Posts: 55  Ally Member
    Well, MariaDB (10.3) on 2GB RPi 4 together with Pi-hole does the job and updates as required!
  • nintendoeats
    nintendoeats Posts: 4  Freshman Member
    UPDATE: I figured out a better way, that works automatically on startup. the previous method required executing those commands every time you rebooted the NAS. Yes, you could run a script from the file I'm going to show you but...I like this better (it's cleaner, and yet slightly naughty).

    SSH into your NAS, and use vi to edit the following file:
    /i-data/longAlphanumeric/.PKG/PHP-MySQL-phpMyAdmin/etc/init.d/PHP-MySQL-phpMyAdmin

    You need to make 2 changes:
    1. ln the chckmd5sum() function, change return 2 to continue (this bypasses the md5 check). This is at line 31.
    2. In the enable() function, find the line with --bind-address=127.0.0.1 and change it to the NAS'es static IP. This is at line 61.
    Save, restart your NAS, have a party.



  • hong
    hong Posts: 1
    Nintendoeats' solution is truly the best! After changed the scripts based on Ek's (https://superuser.com/questions/1127208/remote-access-to-a-mysql-on-zyxel-nas) and other's description it was still needed to do a RESET Password in PHPMySql after every restart.
    With overriding the chkmd5sum check, the Zyxel script starts with the modified parameter set on every restart. Of course, --bind-address=0.0.0.0 is better than a static IP in case of an IP address change.