To use MariaDB with Tiny Core Linux 6 you must provide a data directory that is persistent and writeable. By default, if you install the MariaDB extension and try to run it, you will most likely see an error like this.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
I have documented some instructions here that can be used to create a persistent writeable data directory for MariaDB so that it can run properly.
For this to work we need a persistent
/opt mount point.
I’m assuming you understand persistence in Tiny Core linux, that you already have persistence working, and that you have enough space on your disk for these instructions to work.
Copy MariaDB’s data directory to the persistent
The data directory in the MariaDB extension has a number of files that are symlinked to readonly files. It is critical that you use the
-L flag here as it will copy the symlinked targets rather than the symlinks.
Let’s also delete the existing InnoDB files while we’re at it. Most important to me is that we delete the InnoDB log files as they take up about 100MB, which is much larger than I’d prefer.
We’re going to specify a smaller log file size later on.
/opt/bootlocal.sh and add the following lines.
1 2 3 4 5
This is not a “standard” approach for making configuration change in Tiny Core Linux, but I find that it’s the simplest and most reliable.
Make a copy of
my.cnf so we can change the configuration.
Uncomment the following line in
/opt/mysql/my.cnf so we use a smaller InnoDB log file size.
Reboot to start mysqld
With our changes to
mysqld should automatically start up on our next reboot and use our configuration changes.
mysqld should be running, and you should be able to connect to your server using the
mysql client (it may take a couple of seconds before you can connect).
I can confirm that this minimal installation of MariaDB is sufficient to run WordPress, and I will soon post another article explaining how to get WordPress up and running in Tiny Core Linux 6.
In case you are interested, here is a much more verbose command that can also be used to run
1 2 3 4 5 6 7 8 9
Note that this command specifies a
--datadir option so that
mysqld uses the data directory we setup on
--innodb_log_file_size is also being explicitly set.
It’s not running!
If the server is not running, check the log file or use
ps ax | grep -i mysql to verify
mysqld is actually running.
Also, double check your symlinks and the data directory on
Why not just leverage Tiny Core’s backup system and use .filetool.lst?
Yes, it is possible to solve this problem without needing to change the location of the data directory. You could edit
/opt/.filetool.lst and add
usr/local/mysql/data as a persistent directory.
It’s probably just me, but I was seeing some reliability issues with that method. It seemed like my changes to
.filetool.lst to persist the
data directory were not always loading on reboot.
But more than anything, the reason I decided against that route is that I do not like the idea that I must execute the Tiny Core
backup command to save changes to my databases. What if my machine suddenly loses power? None of the MySQL data would be saved because I never had a chance to run
I prefer having data saved to my opt directory. My
/opt mount is persistent and mounted directly from an attached disk, and so all changes are saved to that persistent disk immediately. It may decrease the life of my flash drive, but this is a very lightly used server I’m configuring, so I’ll take the risk.