How To Install MySQL Server + phpMyAdmin through Entware-NG

0 -  Flash RMerlin firmware from here

1 - Install Entware-NG from here and choose to create swap file

2 - Install lighttpd web server and php from here

3 - Install MySQL

opkg install mysql-server php5-mod-mysqli
mysql_install_db --force
/opt/etc/init.d/S70mysqld restart

4 - Create a password for mysql root user, confirm password and press ENTER

/opt/bin/mysqladmin password desired_mysql_password

5 - Login to mysql

mysql -u root -p

 - Create your first database

mysql> create database my_first_database;
mysql> grant all privileges on my_first_database.* to root@localhost identified by 'desired_mysql_password';
mysql> quit

7 - Download phpMyAdmin, version 4.0.10.15 is the last working on mysql server v5.1, don't try a newer version

cd /opt/share/www/
wget https://files.phpmyadmin.net/phpMyAdmin/4.0.10.15/phpMyAdmin-4.0.10.15-all-languages.zip --no-check-certificate
unzip phpMyAdmin-4.0.10.15-all-languages.zip
mv ./phpMyAdmin-4.0.10.15-all-languages ./phpmyadmin
rm ./phpMyAdmin-4.0.10.15-all-languages.zip

8 - Install required packages

opkg install php5-mod-mbstring php5-mod-json php5-mod-session php5-mod-mysqli

9 - Restart lighttpd

/opt/etc/init.d/S80lighttpd restart

10 - Fix phpmyadmin configuration file

cp /opt/share/www/phpmyadmin/config.sample.inc.php /opt/share/www/phpmyadmin/config.inc.php
chmod 644 /opt/share/www/phpmyadmin/config.inc.php
sed -i 's/localhost/127.0.0.1/g' "/opt/share/www/phpmyadmin/config.inc.php"

11 - Go to your router ip address and port 81/phpmyadmin or www.asusrouter.com:81/phpmyadmin

phpmyadmin112 - Input root as username and password from point 4 then press Go

phpmyadmin2

Now you are ready to make changes on desired databases

This tutorial is dedicated to TheOpenSourceTV :)

 


 

  • raffio

    Before it worked, we hope to update the manual. Thank you

  • Zdeněk Mašek

    Hello

    I`ve tried to install mysql but unfortunately it is failing for me

    admin@RT-AC56U:/# mysql_install_db --force
    /opt/bin/mysql_install_db: line 340: hostname: not found
    chown: unknown user root
    Cannot change ownership of the database directories to the 'root'
    user. Check that you have the necessary permissions and try again.

    Entware-NG, lighttpd and php 5 installed well without issues. But failing in this moment. And to be honest I wanted to use mysql instead of default solution for OwnCloud

    Should I change hostname in mysql_install_db to RT-AC56U? Anything required to resolve change of ownership?

    Thanks

    • mysql-server was replaced with mariadb-server and I will modify the guide but don't know when I will have some free time

      • Zdeněk Mašek

        Ok. Currently with sqlite but anyway failing with SSL. Same lighttpd configuration file as previously but error code 451. Http works well. So have lot of work anyway

      • raffio

        Thanks TeHashX, is there anything I can do while modifying the guide to install mariadb-server without the current error? I
        would appreciate it since I am not able to do the installation in
        debian either, as it gives me a socket error in debian and in entware
        the error that we have talked about.

        Greetings and great work

  • Dark Energy

    Unknown package 'php5-mod-mysql'.

    • opkg install php5-mod-mysqli

  • Gabriel 1onita ♍

    Hi and Happy new year! I wanted to find out if there is any PHP and MySQL update version available for a working Entware-NG. Thank you.
    Let 2017 to be the best year yet for you! :)

    • When you installing a package, it's always the latest. Here is the list for Entware-NG http://entware.zyxmon.org/binaries/armv7/Packages.html
      An updated version is available for now through Optware-NG https://www.hqt.ro/how-to-install-mysql-server-phpmyadmin-through-optware-ng/

      PS
      La mulți ani!

      • Gabriel 1onita ♍

        Yes. But I was wondering how to maintain the Entware-NG updated after a while from installation date. I tried to update with opkg update
        opkg upgrade but lighttpd is not working after that. I got: 403 - Forbidden. I think is because what you pointed at step 7: - Download phpMyAdmin, version 4.0.10.15 is the last working on mysql server v5.1, don't try a newer version. Could you please confirm? Thank you!

        • Updating entware packages should not break lighttpd installation, verify lighttpd.conf file if is been replaced.
          phpMyAdmin is not updated automatically but manually downloaded

          • Gabriel 1onita ♍

            Hi again. Thank you, even is little late. My fault. Please what you pointed at step 7: "Download phpMyAdmin, version 4.0.10.15 is the last working on mysql server v5.1, don't try a newer version." is still valid? Is there any way to update package by package. Something like: [ipkg upgrade transmission]? Appreciate your work. PS: weekend placut :)

          • Don't try a newer version is still valid :)
            To update a single package type "opkg install package-name"
            opkg install transmission

          • Gabriel 1onita ♍

            Thank you! I was so lucky to find your site. I see that you will stop maintaining it. See you on forum :)
            amplatfus

          • Gabriel 1onita ♍

            I appreciate if you could say why newer versions would not working. Many thanks in advance.

          • Because it's not compatible

  • Elz

    Seeing this tutorial published on 15 March is funny in a bad way for me.
    I have successfully installed PhpMyAdmin on my Asus router in 13 March, but it took me 2 hours to do that.
    I have installed the latest PhpMyAdmin version but made this change to the code http://stackoverflow.com/a/27024448/4481831 . It seems is working ok.
    Also a missing step from your tutorial it was to set mysql socket in the config:
    $cfg['Servers'][$i]['socket'] = '/tmp/mnt/usb-stick-name/entware-ng.arm/var/run/mysqld.sock'; otherwise it's not functioning (maybe because older mysql versions have a different path from what is the default in the latest PhpMyAdmin version?... i don't know).

    P.S. this step "/opt/bin/mysqladmin password desired_mysql_password" is missing from your Worpress installation tutorial. 3 days ago I had to read MySQL documentation and made that step myself, otherwise database creation give me error.

    Apropo, salutari din Romania.

    • TeHashX

      About P.S.
      Creating a password for root user is not really necessary, only for security purposes. :)
      Te salut! ;)

  • TheOpenSourceTV

    Thanks so much for the personal tutorial mate! Much appreciated :) Get a Donate button on your website and I'll send you something ;)

    There's a few issues with logging into PHPMyAdmin though, I'm getting this error after logging in (successfully):

    http://digitaldomain.asuscomm.com:81/phpmyadmin/

    phpMyAdmin - Error
    You should upgrade to MySQL 5.5.0 or later.

    The version of mysql-server on the router is 5.1.73-2 and even when i uninstall it and download the latest package, it's the same version...? I notice you have MySQL 5.7.9, although the screenshot is Optware-NG... how'd ya get that higher MySQL version? (I'm still fairly new to this, some beta repository or something?)

    fran@RT-AC66U:/tmp/mnt/Linux/entware-ng/share/www# opkg install php5-mod-mbstrin
    g php5-mod-json php5-mod-session php5-mod-mysql php5-mod-mysqli
    Package php5-mod-mbstring (5.6.17-1) installed in root is up to date.
    Package php5-mod-json (5.6.17-1) installed in root is up to date.
    Package php5-mod-session (5.6.17-1) installed in root is up to date.
    Package php5-mod-mysql (5.6.17-1) installed in root is up to date.
    Package php5-mod-mysqli (5.6.17-1) installed in root is up to date.
    fran@RT-AC66U:/tmp/mnt/Linux/entware-ng/share/www# opkg install mysql-server
    Package mysql-server (5.1.73-2) installed in root is up to date.
    fran@RT-AC66U:/tmp/mnt/Linux/entware-ng/share/www# opkg upgrade mysql-server
    fran@RT-AC66U:/tmp/mnt/Linux/entware-ng/share/www# mysql_install_db --force

    Thanks for all the help, I'm loving messing around with this version of Linux on my router, makes me wanna fix up my old laptop and make a permanent more powerful web server with it :)

    • TeHashX

      You have to install entware-ng and lighttpd from scratch. Screenshots are from optware-ng that's why you see wrong version

      • TeHashX

        See here a response for mysql update https://github.com/Entware-ng/Entware-ng/issues/165
        Latest version is only available on optware-ng

        • TeHashX
          • TheOpenSourceTV

            Thanks, all good, it's working nicely except that now i can't seem to access the ASUS AiCloud web page at https://digitaldomain.asuscomm.com, any ideas? The AiCloud on iOS works perfectly though, what an app! (edit: only after a reboot before the web server has loaded up manually...)

            Actually, whats happening is this, when i reboot the router, i can then access the AiCloud at https://digitaldomain.asuscomm.com with no web server running yet... but when i do a "services restart", AiCloud at https://digitaldomain.asuscomm.com stops working but the Web Server works and WordPress loads up etc. http://digitaldomain.asuscomm.com/wordpress

            Something in the install is causing the https ASUS login page to break...?

            Also, what commands do i run to make lighttpd and mysql auto start on router reboot? Thanks.

          • TeHashX

            All installed entware-ng services starting automatically after every router reboot, maybe you have some other scripts on /jffs partition that can cause to start earlier.
            Add next line in /jffs/scripts/services-start right after $RC start
            logger "Entware-NG services started successfully"
            like this
            "...
            $RC start
            logger "Entware-NG services started successfully"
            "
            Now reboot router and read syslog, should find a line:
            Entware-NG services started successfully

          • TheOpenSourceTV

            Ok so i added those lines to /jffs/scripts/services-start and now the file looks like this:

            #!/bin/sh

            RC='/opt/etc/init.d/rc.unslung'

            i=30
            until [ -x "$RC" ] ; do
            i=$(($i-1))
            if [ "$i" -lt 1 ] ; then
            logger "Could not start Entware-NG"
            exit
            fi
            sleep 1
            done
            $RC start

            logger "Entware-NG services started successfully"

            I've rebooted everything and when the router boots back up i can access the Ai Cloud through https://digitaldomain.asuscomm.com/

            Then in Putty i run this:

            fran@RT-AC66U:/tmp/home/root# services start
            Starting mysqld... already running.
            Starting lighttpd... already running.
            fran@RT-AC66U:/tmp/home/root#

            Web Server is still not showing the WordPress site at http://digitaldomain.asuscomm.com/ ...yet

            So then i do a services restart:

            fran@RT-AC66U:/tmp/home/root# services restart
            Checking lighttpd... alive.
            Shutting down lighttpd... done.
            Checking mysqld... alive.
            Shutting down mysqld... done.
            Restarting Entware-NG Installed Services...
            Starting mysqld... done.
            Starting lighttpd... done.
            fran@RT-AC66U:/tmp/home/root#

            Now i can access http://digitaldomain.asuscomm.com/

            But i can't access the Ai Cloud https://digitaldomain.asuscomm.com/

            So, then i stop lighttpd and i can access http://digitaldomain.asuscomm.com/ but can't access https://digitaldomain.asuscomm.com/ ??

            Seems to be lighttpd config that needs some editing, any ideas?

          • TeHashX

            I'm not using AiCloud not encounter this issue, try to ask in forums http://www.snbforums.com/forums/asuswrt-merlin.42/ and let me know

          • TheOpenSourceTV

            Eventually got it working:

            The following lines were missing from the file /jffs/scripts/firewall-start

            #!/bin/sh
            iptables -I INPUT -p tcp --destination-port 81 -j ACCEPT

            All working now in HTTP and HTTPS so web server and AiCloud both working, everything working! Entware-NG is sweet :)

            Thanks mate.

          • TeHashX

            I'm glad you made it! :)

          • TheOpenSourceTV

            This is my lighttpd.conf file, am i missing somethings in here to make HTTPS work after web services start? Seems only HTTP will work after services start but not HTTPS:

            server.modules = (
            )

            server.document-root = "/opt/share/www"
            server.upload-dirs = ( "/opt/tmp" )
            server.errorlog = "/opt/var/log/lighttpd/error.log"
            server.pid-file = "/opt/var/run/lighttpd.pid"
            #server.username = "http"
            #server.groupname = "www-data"

            index-file.names = ( "index.php", "index.html",
            "index.htm", "default.htm",
            "index.lighttpd.html" )

            static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )

            ### Options that are useful but not always necessary:
            #server.chroot = "/"
            server.port = 81
            #server.bind = "localhost"
            #server.tag = "lighttpd"
            #server.errorlog-use-syslog = "enable"
            #server.network-backend = "write"

            ### Use IPv6 if available
            #include_shell "/opt/share/lighttpd/use-ipv6.pl"

            #dir-listing.encoding = "utf-8"
            #server.dir-listing = "enable"

            include "/opt/etc/lighttpd/mime.conf"
            include_shell "cat /opt/etc/lighttpd/conf.d/*.conf"

      • TheOpenSourceTV

        I installed everything from scratch again, then moved the newly created entware-ng\share\www\phpmyadmin folder from the new install to my main other install with lots of stuff already installed on it that I didn't want to have to redo again.
        Renamed the Entware-NG folders so my main install loaded up next time, then rebooted, loaded up the PHPMyAdmin login page and all that had to be done was change the permissions on the file share\www\phpmyadmin\config.inc.php to not be writable by all.
        PHPMyAdmin is now working on my main Entware-NG install, happy days! :)

        http://snag.gy/zhOeH.jpg

    • TeHashX

      Thank you, much appreciated
      https://www.hqt.ro/donate/

      • TheOpenSourceTV

        Done, thanks for all your help ;)

Get Email Notification When a Server or Port is Unreachable
SoftEther VPN Running on AsusWRT Routers
Minidlna UPnP Media Server through Debian Jessie Arm
How to Mount Samba Shares inside Chrooted Debian
Minidlna UPnP Media Server through Debian Jessie Arm
How to Mount Samba Shares inside Chrooted Debian
Spreed WebRTC server and web client
Asterisk VoIP Server running on AsusWRT Routers
Get Email Notification When a Server or Port is Unreachable
SoftEther VPN Running on AsusWRT Routers
NZBGet through Entware
Minidlna UPnP Media Server through Debian Jessie Arm

SUBSCRIBE

To be notified by email when a new tutorial is posted :)

Thanks for Subscribing! I'll keeping you up-to-date with latest tutorials!

Something went wrong, try again...