Replace mairadb with mysql please help

An inexpensive Raspberry Pi-class device running a "full" Linux OS may be another good option because of its greater memory, broader package offerings, and higher processing capabilities.

2 Likes

ok - now i'm starting to wonder if the router is having issues all it's own - when i went to install fdisk using opkg it tells me that it's a read only file system - i installed and uninstalled mariadb several times earlier and never got this error - tried to remove it now and get the same thing

jffs2 gets "very unhappy" if filled to capacity and the kernel may have changed the file system to read-only due to errors

I assume this is for some kind of business purposes in which case I strongly recommend to buy a zotac ci327 and put a 128Gig SSD in it and get a 2.5 inch external spinning disk on usb3 to pull backups. End of problems. Run Debian on it, and if it needs to route also put openwrt on a VM.

ok sooooo - after it was telling me the filesystem was read only i did a complete re-flash of the device - installed usb, fdisk, setup partitions, mounted everything - did the swapspace like johnnysi shows above - NOW i'm getting a new message

error: could not open mysql.plugin table. some plugins may not be loaded
error: can't open and lock privilege tables: table 'mysql.servers' doesn't exist
note: server socket created on ip: 127.0.0.1
error: can't start server : bind on unix socket: no such file or directory
error: do you already have another mysql server running on socket: /var/run/mysqld/mysqld.sock?
error: aborting

the file it's referring to (var/run/mysqld/mysqld.sock) doesn't exist (in fact the whole directory doesn't exist)
but seems like i'm getting closer - doing find / -name "mysqld.sock" returns no result

thanks for all the help so far - any thoughts on this
and yeah - i'm probably gonna change to a different router in the end but it's all a learning experience

/var/ is a memory-backed file system that does not survive reboots. You likely need to create the proper directory structure (and perhaps pipes, for some applications) in the start-up script for the service.

1 Like

please explain this further?

also - did a search for mysqld.sock returns no result whatsoever

When the router reboots, /var/ (which is symlinked to /tmp/) is empty. If you need a specific directory there for a service to use, you likely need to create it yourself. Take a look at, for example, /etc/init.d/boot which on my box starts with

boot() {
        [ -f /proc/mounts ] || /sbin/mount_root
        [ -f /proc/jffs2_bbc ] && echo "S" > /proc/jffs2_bbc
        [ -f /proc/net/vlan/config ] && vconfig set_name_type DEV_PLUS_VID_NO_PAD

        mkdir -p /var/run
        mkdir -p /var/log
        mkdir -p /var/lock
        mkdir -p /var/state
        mkdir -p /var/tmp
        mkdir -p /tmp/.uci
        chmod 0700 /tmp/.uci
        touch /var/log/wtmp
        touch /var/log/lastlog
        touch /tmp/resolv.conf.auto

In the case of something service-specific, it might be more appropriate to put it into /etc/init.d/mysql or whatever the start-up script is named.

1 Like

The main thing you're going to learn here is that routers designed around embedded low-ram low-storage use-cases aren't really good for running databases. You need at least something RPi class to have this make sense. All the things you "learn" getting this to work will be things you didn't need to spend time on with a machine appropriate to this task.

2 Likes

I rebooted the router, set it up to do the mkdir for the var/run/mysqld directory - but when i went to load the swap space again and give it another try it started giving me more issues saying no space on device and seems every time i turn around one thing or another goes wrong.

so - just wanted to tell you guys thanks for all the help - at this point i'm abandoning this idea completely and i'm just going to build a mint box to do what i was going to do with this Again - Thanks everyone

3 Likes

That's clearly the right solution!

Sorry, I don't agree with @dlakelan. Routers we have these days (R7800, WRT3200, etc) have plenty of power to run a reasonable simple database. no need to grab multiple or heavy intel cpu based boxes for that.
That being said, getting it to run on your particular router is a slight challange due lack of memory and likely horsepower.

Regarding your database issues.

  1. it sounds like you were (are) trying to build your swap file on the internal filesystem instead of on the mounted usb drive. if that now is resolved, you are a step further down the path to success. Else you need to check if your usb-drive is properly mounted and accessible.
  2. you don't need to mess around with the directories for mysqld like you mentioned in your posts, the only thing you need, is to tell mysql where to store its databases (not on the internal filesystem, but on the usb stick).

have a look at these lines in /etc/mysql/my.cnf

############ Don't put this on the NAND #############
# Figure out where you are going to put the databases
# And run mysql_install_db --force
datadir         = /mnt/usb/apps/mysql/

######### This should also not go on the NAND #######
tmpdir          = /mnt/usb/apps/mysql/tmp/

as you can see i moved my databases and tmpdir for mysql to a subdir in /mnt/usb.

and /mnt//usb is the mount of the usbdrive

root@Linksys:~# mount
<snip>
/dev/sdb1 on /mnt/usb type ext4 (rw,relatime,data=ordered)

So you might want to give it a final try with the advice from my.cnf :wink:

1 Like