Mysql Mybooklive

Hello friends, I installed OpenWrt in my my live book,
I am using http uHTTPd server, to make a server of mine, it is working.
I also installed php for uHTTPd
working now when I try to install msql by running cmd:
opkg install libpthread libncurses libreadline mysql-server, I run into this error:

root@OpenWrt:~# opkg install libpthread libncurses libreadline mysql-server
Package libpthread (1.1.19-1) installed in root is up to date.
Package libncurses (6.1-1) installed in root is up to date.
Package libreadline (7.0-1) installed in root is up to date.
Installing mariadb-server (10.1.41-2) to root...
Downloading http://downloads.openwrt.org/releases/18.06.4/packages/powerpc_464fp/packages/mariadb-server_10.1.41-2_powerpc_464fp.ipk
Configuring mariadb-server.
mysqld: cannot detect privileges table, you might need to
mysqld: run 'mysql_install_db --force' to initialize the system tables

when I do the force happens to me this:

root@OpenWrt:~# mysql_install_db --force
Installing MariaDB/MySQL system tables in '/mnt/data/mysql/' ...
2019-10-20 12:36:10 3081511068 [Note] /usr/bin/mysqld (mysqld 10.1.41-MariaDB) starting as process 4419 ...
2019-10-20 12:36:10 3081511068 [Note] InnoDB: innodb_empty_free_list_algorithm has been changed to legacy because of small buffer pool size. In order to use backoff, increase buffer pool at least up to 20MB.

2019-10-20 12:36:10 3081511068 [Note] InnoDB: Using mutexes to ref count buffer pool pages
2019-10-20 12:36:10 3081511068 [Note] InnoDB: The InnoDB memory heap is disabled
2019-10-20 12:36:10 3081511068 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2019-10-20 12:36:10 3081511068 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2019-10-20 12:36:10 3081511068 [Note] InnoDB: Compressed tables use zlib 1.2.11
2019-10-20 12:36:10 3081511068 [Note] InnoDB: Using Linux native AIO
2019-10-20 12:36:10 3081511068 [Note] InnoDB: Using generic crc32 instructions
2019-10-20 12:36:10 3081511068 [ERROR] mysqld: Can't create/write to file '/mnt/data/tmp/ibXXXXXX' (Errcode: 2 "No such file or directory")
2019-10-20 12:36:10 b7ac209c  InnoDB: Error: unable to create temporary file; errno: 2
2019-10-20 12:36:10 3081511068 [ERROR] Plugin 'InnoDB' init function returned error.
2019-10-20 12:36:10 3081511068 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2019-10-20 12:36:10 3081511068 [ERROR] Unknown/unsupported storage engine: InnoDB
2019-10-20 12:36:10 3081511068 [ERROR] Aborting


Installation of system tables failed!  Examine the logs in
/mnt/data/mysql/ for more information.

The problem could be conflicting information in an external
my.cnf files. You can ignore these by doing:

    shell> /usr/bin/mysql_install_db --defaults-file=~/.my.cnf

You can also try to start the mysqld daemon with:

    shell> /usr/bin/mysqld --skip-grant-tables --general-log &

and use the command line tool /usr/bin/mysql
to connect to the mysql database and look at the grant tables:

    shell> /usr/bin/mysql -u root mysql
    mysql> show tables;

Can someone help me just missing this to be all OK

mkdir -p /mnt/data/tmp
1 Like

@wulfy23

root@OpenWrt:~# mkdir -p /mnt/data/tmp
root@OpenWrt:~# mysql_install_db --force
root@OpenWrt:~# /etc/init.d/mysqld start
mysqld: cannot detect privileges table, you might need to
mysqld: run 'mysql_install_db --force' to initialize the system tables

mysql_install_db --force --basedir=/usr
1 Like

@wulfy23

root@OpenWrt:~# mysql_install_db --force --basedir=/usr
root@OpenWrt:~#
root@OpenWrt:~# /etc/init.d/mysqld start
mysqld: cannot detect privileges table, you might need to
mysqld: run 'mysql_install_db --force' to initialize the system tables

Don't want to access the device to view and resolve?

ubus call system board
1 Like

@wulfy23

{
        "kernel": "4.14.131",
        "hostname": "OpenWrt",
        "model": "MyBook Live",
        "board_name": "wd,mybooklive",
        "release": {
                "distribution": "OpenWrt",
                "version": "18.06.4",
                "revision": "r7808-ef686b7292",
                "target": "apm821xx\/sata",
                "description": "OpenWrt 18.06.4 r7808-ef686b7292"
        }
}

i am accessing by ssh there i can give access to my pc so i can solve

opkg install strace
strace mysql_install_db --force --basedir=/usr 2>&1 | grep -E '(read|ENOENT)' | grep -v 10

@wulfy23

root@OpenWrt:~# opkg install strace
Installing strace (4.22-1) to root...
Downloading http://downloads.openwrt.org/releases/18.06.4/packages/powerpc_464fp/base/strace_4.22-1_powerpc_464fp.ipk
Configuring strace.
root@OpenWrt:~# strace mysql_install_db --force --basedir=/usr 2>&1 | grep -E '(read|ENOENT)' | grep -v 10
root@OpenWrt:~#
root@OpenWrt:~# /etc/init.d/mysqld start
mysqld: cannot detect privileges table, you might need to
mysqld: run 'mysql_install_db --force' to initialize the system tables

hmmmm..... both the strace command and the install_db command should have produced output....

i'm thinking it could be target package related but without output from those commands.... not too sure whats going on there...

How do I enable command output? or what files / commands do you need?

@wulfy23

I followed this tutorial:

https://openwrt.org/docs/guide-user/services/webserver/lamp,
using:
1- uHTTPd

2- Installing and Configuring PHP

3- Installing and configuring a database server

try adding some swap... and rerun the install_db command....

which some swap
????

Hi all,

mysqld switches from root to user mariadb when it starts up. So all the folders that it uses (like tmpdir) need to have permissions adjusted for that. For instance the user mariadb needs to have write access to tmpdir etc.

Regarding RAM, yes, that can be an issue. On my 128 MB RAM device I can't run the server without adding a swap file. In another forum topic (here) it was reported that you can run it on a 512 MB RAM device without swap.

@micmac1
Thanks for the reply, and now solved now another problem:
I have php7-mod-mysqli installed but dame error:

bugal error: Error not captured: 'mysqli' class not found in /svr/www/demo/index.php:7 Stack trace: # 0 {main} thrown in /svr/www/demo/index.php on line 7

Glad you got it working. Regarding the php issue I don't know.

Certainly not, the swap is a USB/MMC/uSD/SSD killer !
You can use swap ONLY on real harddisk...

Swap on an SSD is fine.

Running anything on an embedded device that requires swap is not a wise idea. Too many more appropriate SBCs out there at reasonable prices to even do the math around 5-10 MB/s transfer rates and hundreds of MB of swap.

Hi, how did you solve the issue? I am accounting the same issue..