What's new
  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

mariadb problem

yhq_34

Occasional Visitor
Hi;

I installed mariadb in my ac68u. Why every-time I reboot the router it will no start auto? Are there any solutions?
 
How did you install mariadb and where to?
 
It seems mariadb does not provide an autostart script during install.
Make sure the initial setup is made for mariadb, then try adding this line at the end of /jffs/scripts/post-mount
Code:
/opt/etc/init.d/S70mariadbd start
 
I added it but seems doesn't work, below was my post-mount file.

#!/bin/sh


if [ "$1" = "/tmp/mnt/sdb1" ] ; then

ln -nsf $1/entware /tmp/opt

fi


if [-f /tmp/opt]

then

swapon /tmp/mnt/sdb1/myswap.swp

fi


/opt/etc/init.d/S70mariadbd start


/opt/etc/init.d/S49vsftpd start
 
Does Entware run?
Code:
opkg -v
Since you have not labeled your device, the system assigns the first available device name to it, sda1, then sdb1 and so forth.
It might be that your device is actually mounted as sda1.
Try giving your device a distinctive label and change all occurrences in /jffs/scripts/* to the new name and then reboot.
Something like router-stick or so, in the end you'd have this path which is always correct:
Code:
/tmp/mnt/router-stick
 
Yes, it's ok.
opkg -v

opkg version 0.1.8

entware is normal, why cannot start mariadb when router boot?
 
Last edited:
What is the output if you run the startcommand manually?
Code:
/opt/etc/init.d/S70mariadbd start
And if it's running:
Code:
/opt/etc/init.d/S70mariadbd status
 
I found it won't start until I add swap file to router.

admin@AC68U:/tmp/home/root# /opt/etc/init.d/S70mariadbd restart

admin@AC68U:/tmp/home/root# /opt/etc/init.d/S70mariadbd status

mysqld is not running

admin@AC68U:/tmp/home/root# swapon /tmp/mnt/sdb1/myswap.swp

admin@AC68U:/tmp/home/root# /opt/etc/init.d/S70mariadbd restart

admin@AC68U:/tmp/home/root# /opt/etc/init.d/S70mariadbd status

mysqld is not running

admin@AC68U:/tmp/home/root# /opt/etc/init.d/S70mariadbd status

mysqld is already running
 
Your swap file is not ready at the time it starts mariadb, thus running out of memory I presume.

Rearrange your post-mount file thus, changing the sleep time to a higher value if it does not work.
Don't make the sleep time too long (40 would be extremely high):
Code:
#!/bin/sh

if [ "$1" = "/tmp/mnt/sdb1" ] ; then

ln -nsf $1/entware /tmp/opt

fi

if [-f /tmp/opt]

then

swapon /tmp/mnt/sdb1/myswap.swp

fi

/opt/etc/init.d/S49vsftpd start

# add sleep to give swapfile time to load, value is in seconds
sleep 5
/opt/etc/init.d/S70mariadbd start
 
I found mariadb was OK. thanks a lot.
by the way is that normal for start mariadb needs swap space? after mariadb started and swap space was not been used.
<code>
free

total used free shared buffers cached

Mem: 255708 151748 103960 0 512 19376

-/+ buffers/cache: 131860 123848

Swap: 2093052 0 2093052
</code>
 
I believe this is a built in minimum requirement, haven't checked tough.
Since the db mostly is accompanied by a webserver and additional server side script languages, they need some additional swap space.
Apache is the most demanding while nginx and the others available through Entware use a lot less recources.
I would not be worried about the unused swap space.
 

Similar threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Back
Top