How To Install MySQL Server + phpMyAdmin through Optware-NG

1 - Install Optware-NG from here and choose 2GB swap file

2 - Install lighttpd web server and php from here

3 - Install MySQL (ignore InnoDB: posix_fallocate errors)

ipkg install mysql

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

/opt/bin/mysqladmin password

5 - Login to mysql shell

mysql -u root -p

 - Create your first database, user and password (change values in red)

mysql> create database my_first_db;
mysql> grant all privileges on my_first_db.* to my_first_db_username@localhost identified by 'my_first_db_password';
mysql> quit

7 - Download phpMyAdmin (change version number if is updated)

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

8 - Install required packages

ipkg install php-mbstring php-mysql

9 - Restart lighttpd

/opt/etc/init.d/S80lighttpd restart

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

phpmyadmin111 - Input credentials from point 6 then press Go

phpmyadmin2

Now you are ready to make changes on desired databases

 


 

  • Galbeida

    How do I restart the mysql server? Thank you

    • services restart

      • Galbeida

        Thank you!!!!

  • Evil Kreve

    Hi!
    I have some troble issues while installing
    ipkg install mysql

    Error:
    Collected errors:
    * opkg_download: Failed to download http://ipkg.nslu2-linux.org/optware-ng/buildroot-armeabi-ng/mysql_5.7.9-7_arm.ipk, wget returned 3.
    * opkg_install_pkg: Failed to download mysql. Perhaps you need to run 'ipkg update'?
    * opkg_install_cmd: Cannot install package mysql.

    Some log of mine :)
    Linux lolNET2.6.36.4brcmarm #1 SMP PREEMPT Sun Aug 21 12:47:53 MSK 2016 armv7l GNU/Linux
    lolo@lolNET:/tmp/home/root# mount
    rootfs on / type rootfs (rw)
    /dev/root on / type squashfs (ro,relatime)
    devtmpfs on /dev type devtmpfs (rw,relatime,size=62812k,nr_inodes=15703,mode=755)
    proc on /proc type proc (rw,relatime)
    tmpfs on /tmp type tmpfs (rw,relatime)
    sysfs on /sys type sysfs (rw,relatime)
    devpts on /dev/pts type devpts (rw,relatime,mode=600)
    /dev/mtdblock4 on /jffs type jffs2 (rw,noatime)
    usbfs on /proc/bus/usb type usbfs (rw,relatime)
    /dev/sda5 on /tmp/mnt/nas type tntfs (rw,nodev,relatime,uid=0,gid=0,umask=00,nls=utf8,min_prealloc_size=64k,max_prealloc_size=128M,readahead=1M,user_xattr,case_sensitive,nocache,fail_safe,hidden=show,dotfile=show,errors=continue,mft_zone_multiplier=1)
    /dev/sda1 on /tmp/mnt/opt type ext3 (rw,nodev,relatime,errors=continue,user_xattr,barrier=0,data=ordered)
    lolo@lolNET:/tmp/home/root# df
    Filesystem 1K-blocks Used Available Use% Mounted on
    /dev/root 26624 26624 0 100% /
    devtmpfs 62812 0 62812 0% /dev
    tmpfs 62920 1020 61900 2% /tmp
    /dev/mtdblock4 97024 2592 94432 3% /jffs
    /dev/sda5 2921516384 527273056 2394243328 18% /tmp/mnt/nas
    /dev/sda1 8601820 2394760 5770108 29% /tmp/mnt/opt
    lolo@lolNET:/tmp/home/root# free
    total used free shared buffers
    Mem: 125840 52332 73508 0 760
    -/+ buffers: 51572 74268
    Swap: 2097148 1084 2096064

    i'm using Merlin on Huawei WS880.
    optware 4 arm - installed
    minidlna - installed
    minihttpd - installed

  • TheOpenSourceTV

    Can't get MySQL installed properly... any ideas? Tried removing it and installing it again but same errors as below:

    ASUSWRT-Merlin RT-AC66U_3.0.0.4 Thu Dec 24 18:54:38 UTC 2015
    fran@RT-AC66U:/tmp/home/root# ls
    fran@RT-AC66U:/tmp/home/root# ipkg install mysql --force-reinstall
    Reinstalling mysql (5.7.11-1) on /opt/...
    Downloading http://ipkg.nslu2-linux.org/optware-ng/buildroot-mipsel-ng/mysql_5.7.11-1_mipsel.ipk
    conffile_has_been_modified: conffile /opt/etc/my.cnf has no md5sum
    conffile_has_been_modified: conffile /opt/share/mysql/support-files/mysql.server has no md5sum
    Configuring mysql
    2016-03-20T06:19:17.357997Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
    2016-03-20T06:19:17.382374Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting.
    2016-03-20T06:19:17.382887Z 0 [ERROR] Aborting

    =====================================================
    After mysqld starts, don't forget to execute
    /opt/bin/mysqladmin password
    to set root password
    =====================================================
    Starting MySQL.......................................................................................... ERROR! The server quit without updating PID file (/opt/var/lib/mysql/RT-AC66U.pid).
    postinst script returned status 1
    ERROR: mysql.postinst returned 1
    Successfully terminated.
    fran@RT-AC66U:/tmp/home/root#

    Thanks.

    • TeHashX

      No idea, install optware-ng and mysql from scratch after rebooting router

      • TheOpenSourceTV

        So strange, i completely reinstalled Optware-NG, then Lighttpd, PHP, then MySql and the same errors for MySQL... wtf? :(

        ASUSWRT-Merlin RT-AC66U_3.0.0.4 Thu Dec 24 18:54:38 UTC 2015
        fran@RT-AC66U:/tmp/home/root# ipkg install mysql
        Installing mysql (5.7.11-1) to /opt/...
        Downloading http://ipkg.nslu2-linux.org/optware-ng/buildroot-mipsel-ng/mysql_5.7 .11-1_mipsel.ipk
        Installing libevent (2.0.20-1) to /opt/...
        Downloading http://ipkg.nslu2-linux.org/optware-ng/buildroot-mipsel-ng/libevent_ 2.0.20-1_mipsel.ipk
        Configuring libevent
        Configuring mysql
        2016-03-20T09:10:32.971299Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
        2016-03-20T09:11:20.799469Z 0 [Warning] InnoDB: New log files created, LSN=45790
        2016-03-20T09:11:34.778122Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
        2016-03-20T09:11:39.116031Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: c10184d6-ee7b-11e5-8853-ac220b2f23e8.
        2016-03-20T09:11:39.647289Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
        2016-03-20T09:11:58.537320Z 0 [Warning] CA certificate ca.pem is self signed.
        2016-03-20T09:12:01.458050Z 1 [Warning] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
        2016-03-20T09:12:01.459940Z 1 [ERROR] 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CREATE DATABASE mysql;
        ' at line 1
        2016-03-20T09:12:01.461778Z 0 [ERROR] Aborting

        =====================================================
        After mysqld starts, don't forget to execute
        /opt/bin/mysqladmin password
        to set root password
        =====================================================
        Starting MySQL....................... ERROR! The server quit without updating PID file (/opt/var/lib/mysql/RT-AC66U.pid).
        postinst script returned status 1
        ERROR: mysql.postinst returned 1
        Successfully terminated.
        fran@RT-AC66U:/tmp/home/root# ls
        fran@RT-AC66U:/tmp/home/root#

        • TeHashX
          • dpeterson

            I have the same issue

          • TeHashX

            Try again now, Alllexx downgraded mysql to v5.7.9 from v5.7.11 and it works fine again, I also slightly modified the guide.

          • TeHashX

            phpMyAdmin updated to v4.6.0

  • Happy_User

    Thanks for this!

    • TeHashX

      You are very welcome :)

  • Zdeněk Mašek

    hi

    can you guide me how to increase swap file? mine is just 512 as I was installing it with this amount.
    thanks

    • Sure

      cd /opt
      swapoff /opt/swap
      rm ./swap
      dd if=/dev/zero of=/opt/swap bs=1024 count=2097152
      mkswap /opt/swap
      chmod 0600 /opt/swap
      swapon /opt/swap

      • Zdeněk Mašek

        Thx. I'll do it soon. Next step entware-ng + nginx + MySQL + owncloud. Too many files on my connected disc so want to try some performance tuning

        • Zdeněk Mašek

          so I have tried but as usuall not that easy as I got error message when I wanted to turn the swap off (cannot allocate memory). but after I've stopped lighttpd server it works perfectly. many thanks

          • On entware
            opkg install mysql-server

          • Zdeněk Mašek

            thanks. this works perfectly. Next time I should use more basic documentation to use list function instead of asking stupid question to bother you. Thanks

  • Incognito Psytrancer

    Очень, очень хорошо! Спасибо!

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...