MySQL / MariaDB recovery

Hi All,

A package upgrade exercise recently resulted in the deletion of a MariaDB server and client packages. This was completely unintended but fortunately the database only held web app configuration and accounts but not the data uploaded through the app. I can recreate the configuration and accounts but would strongly prefer to recover the DB if possible.

I've never attempted anything like that nor have I found too much information on how to even being recovering from a simple deletion... A quick look into /var/db/mysql/ seems to indicate that the data files were left behind. Here's where the questions kick in...

  1. Does a pkg upgrade package removal of MySQL or MariaDB result in database file deletions?
  2. If it doesn't, does that mean that the original data is likely to be intact and only the DB engine and configuration are gone?
  3. If the packages are reinstalled, how do I restore the data back to the DB? Presumably the directory presence isn't sufficient. Online manuals typically explain the process of importing previous DB dumps... not the case here.

A bit lost. 🤔 Anything to help me get started would be most appreciated.

Thanks,
Janusz
 
Hi Janusz!

Maybe stupid question to you. Do you have a backup of your full MySQL/MaraiDB database or even for only specific DB?
 
First, make an archive copy of your /var/db/mysql before changing anything! If using ZFS also a snapshot would be a good idea.

Does a pkg upgrade package removal of MySQL or MariaDB result in database file deletions?
Deinstallation does not remove your data (I think). It deletes only the paths described in the package's metadata.
This is what pkg info -R mysql56-server outputs on my system, /var/db/mysql is not among the package artifacts. Even the mysql configuration file should still be around, if you have any:
Code:
name = "mysql56-server";
...
files {
    /usr/local/bin/innochecksum = "1$d6e04533d3e1988289f7ed03ce9c5719139ae731d4ce6f1b80296ad757356c2e";
    /usr/local/bin/my_print_defaults = "1$9db17d26941d3e9c97307c398c74853b6b58b333b42672263d255c533a38a448";
    /usr/local/bin/myisam_ftdump = "1$10f7d83e592be2c2af2281447c8be3c6d17a34e233254aef34915f1315b1a380";
    /usr/local/bin/myisamchk = "1$4dd3e40b5f9ca5585334ee2d4bfda953322292e9f0b642b16d6085885aef7f0a";
    /usr/local/bin/myisamlog = "1$733fd6cc947e30d0b910328a92f4345875ae0ec3bb1ad1629ca38e6179281e0e";
    /usr/local/bin/myisampack = "1$d6dc01a0c780d2b1fed90ec19106786f30bbd086aff79221d74f3165f2690f59";
    /usr/local/bin/mysql_convert_table_format = "1$f526b12f9792af4990d3f0ae88ffa09ff71a9789242d80b1103a9206c7e1dcf5";
    /usr/local/bin/mysql_fix_extensions = "1$4ea1c600d56174eaf280ee5e47aea38ce718abc753705437b244982d9df8a029";
    /usr/local/bin/mysql_install_db = "1$5882f4c4e8758d441d9bc248add73b4f1d122d94e827581ef4faa1687a049c43";
    /usr/local/bin/mysql_plugin = "1$e8f996f052193e5e93561257c13933762cc45f4fb5e78206a92ed98559acbb9b";
    /usr/local/bin/mysql_secure_installation = "1$9a198eeebdd9abbf4050e1dca78c18f8e24e1832ea45692e6be2cbd17014b15e";
    /usr/local/bin/mysql_setpermission = "1$67fca595c511c50e07995c666b7e79e28fca8fae7a7877304bb449ce6e7a7356";
    /usr/local/bin/mysql_tzinfo_to_sql = "1$37f625834fe452e9e655290ea28c8568a04d02826cef299a55218bdd8e538691";
    /usr/local/bin/mysql_upgrade = "1$7764af619ee53eb5226238b0121a69f84749aa6cede2c39fed4c295f5baa9c2b";
    /usr/local/bin/mysql_zap = "1$d2f746d05c6fcff8ecc7070d397959aab441505b7d3fd6f064541a8cdcf95edf";
    /usr/local/bin/mysqlbug = "1$5b1db8993a5d4039c74a28e84d1214211b7ff45aff570361db0a9898c6cfa8d7";
    /usr/local/bin/mysqld_multi = "1$25c0a07419ff2fd6214e38eb0f43a8418a4c91b4bf1b695fb95e99ab7621377c";
    /usr/local/bin/mysqld_safe = "1$e95c93380496ddd501b74c2e8d9a0e0c006f5c639fb1a3583e33c507e022b304";
    /usr/local/bin/mysqldumpslow = "1$259bfcc670da81efaa4a9f366aaca5c46b2a762aa1f8dfaf45c9e35c9faf6c76";
    /usr/local/bin/mysqlhotcopy = "1$d3078be6af39ad32a188727da8c7964a89105f19bc10c6119ccd0ce1da24516b";
    /usr/local/bin/mysqltest = "1$e889c385a13f2fda71f30628a8a409a4a49e30bb12d83d6798634d23a9191903";
    /usr/local/bin/perror = "1$740ba0ae29fd636f05c7e1d4304b33601d02891282748c24012ec0ed8fc735f9";
    /usr/local/bin/replace = "1$c7bf977a6f6cccebcd6cdb6d3d2f0884ffa656d8de8edf336f44c831edcfe342";
    /usr/local/bin/resolve_stack_dump = "1$a473c2b7135b18e561d2dc231d9e2e18ae0d296abcbc63ff68f0623a38901a2c";
    /usr/local/bin/resolveip = "1$b99fa6b6bded21f875b0a82ad5148cff16a786ee9e65d79b6c41390e165ef1e5";
    /usr/local/etc/mysql/my.cnf.sample = "1$b58226b601ee7cf3ebb2b04c002167290f350fa64d4c0ef6a0f6d27a7e35e92e";
    /usr/local/etc/rc.d/mysql-server = "1$a6e066b3dcb71cac282bcf8b8580fe7764bbaee6e7fbcd0300455fb4fe39ed5f";
    /usr/local/lib/mysql/libmysqld.a = "1$e0f279c612515d0ebbf906f51ecacdef6f9d0d33f64d1d112b7020013ac570bf";
    /usr/local/lib/mysql/plugin/adt_null.so = "1$6023f7711bd739724dca700c0db342dc7b047cde113836300b3a154a5d37ba54";
    /usr/local/lib/mysql/plugin/auth.so = "1$c6d7fe8420e1c36fb86ddcf598050757eef9dade437992f9ef7321d455473b23";
    /usr/local/lib/mysql/plugin/auth_test_plugin.so = "1$a2045dee631642f3ad13a93291d61b7db84e0a25337e28f571eb0afe1045fb06";
    /usr/local/lib/mysql/plugin/connection_control.so = "1$a2e9ef8d642b1d8da084f6c6178f905790493860c6db92e73e90cbd5a9b2cc06";
    /usr/local/lib/mysql/plugin/daemon_example.ini = "1$bf48bf5bab050e8222a5e05b6f82d278286d62511c5aa300ed4938bc425de038";
    /usr/local/lib/mysql/plugin/libdaemon_example.so = "1$e759ce7a208bece18ad35903a58116ad92c46897e61b3143524263bf54ee38f2";
    /usr/local/lib/mysql/plugin/mypluglib.so = "1$5355c29b675c2d5a40be799aeb2cac6f47a4878d4d212569be51f33bdc49f251";
    /usr/local/lib/mysql/plugin/mysql_no_login.so = "1$4095c618034692f168c6557a3c41196a35f4a00fded9d081c3d4a64015f76a6e";
    /usr/local/lib/mysql/plugin/qa_auth_client.so = "1$366914685ed71cab25b99748f9bc9086f38d7c414902ea33889b32c3b9b44b20";
    /usr/local/lib/mysql/plugin/qa_auth_interface.so = "1$81bf7a643b40783871a089ccfda5e996e7d15571972390949768a6f140a7fdd1";
    /usr/local/lib/mysql/plugin/qa_auth_server.so = "1$4efb52cd062da0071616be05cf51adc2504c1f43675502eadca9e6f022f4ce75";
    /usr/local/lib/mysql/plugin/semisync_master.so = "1$0ed1f3ff6ab9b7188d0e7d3e0d673d61b9837c6e8e5d7e80ffdc34fc37216543";
    /usr/local/lib/mysql/plugin/semisync_slave.so = "1$af0110f8b67ea729c9ca2bd665aedd4c088048531fb037ac963ff0ef2c58507f";
    /usr/local/lib/mysql/plugin/test_udf_services.so = "1$f5ae853e8237aa14b8afca176932d1fec72403b057c7587b08152b414827ee7f";
    /usr/local/lib/mysql/plugin/validate_password.so = "1$1209acd313e2f20950dca19cc00249ce9457eb29b45e921837215357e8172d53";
    /usr/local/libdata/ldconfig/mysql56-server = "1$2f4c3dc7f9ed06964731cc6fa2196f0dbad622262f42392b576cd5df96b8bd38";
    /usr/local/libexec/mysqld = "1$7b7367a55f3736f50009c25c779b2e1f363fe1052b13c8254b477ab923df0780";
    /usr/local/man/man1/my_print_defaults.1.gz = "1$09a0dbe8777a9019fa251dd2bc5a6330b8f5a6799382dc345b4ed46206cada4e";
    /usr/local/man/man1/myisam_ftdump.1.gz = "1$a1f678f225bf88648984bc813b61936cb158f1ef72d081228ded1e54f6186404";
    /usr/local/man/man1/myisamchk.1.gz = "1$ff40db0839aaff258fcf533b61e6f98137b903e815c2a64146f6063f27d87f3a";
    /usr/local/man/man1/myisamlog.1.gz = "1$01b860e2be4ff3599be9df706d2074682b2e12ec671d364c129252963d39bc6e";
    /usr/local/man/man1/myisampack.1.gz = "1$8c09933796f27dc25c005336ae0d5129e7d16814e1716009782473965d27d126";
    /usr/local/man/man1/mysql.server.1.gz = "1$9f8b64996aec116fedf73541af4857ca41975267caa50ba7dd31f3108ad5ffb2";
    /usr/local/man/man1/mysql_convert_table_format.1.gz = "1$0c08edde8908ef5ecba3dc7b535dd8a4edfec208fc7ce3c186f12499101f3ec7";
    /usr/local/man/man1/mysql_fix_extensions.1.gz = "1$15a2019afb394d872e2acabf66562c017369f3a780542e1d03a45832a298248d";
    /usr/local/man/man1/mysql_install_db.1.gz = "1$278f4cb98f520de368dad421d2b893ae2849c35ffa90b9c3fe4d4bf69da63e59";
    /usr/local/man/man1/mysql_plugin.1.gz = "1$296d8dbc32f70900de23293218d967667883e3f520f6be56fffbda432d4afb72";
    /usr/local/man/man1/mysql_secure_installation.1.gz = "1$9a07943614437e804a0bb6f65d286089f1b70de92665a0836786a66e5300f6d9";
    /usr/local/man/man1/mysql_setpermission.1.gz = "1$f4e5df78547c9492bab09774796b4f6f15b957596114c243c55bf81604f260f9";
    /usr/local/man/man1/mysql_tzinfo_to_sql.1.gz = "1$960a1cae7a1e8f40a459e8811cda3d36bd9ef85294830c9a32523a4343793fa2";
    /usr/local/man/man1/mysql_upgrade.1.gz = "1$49bbfa41378dbfe1c6df814f145876fc92503c9b26e8bf14df9e4aa28d6f5b1d";
    /usr/local/man/man1/mysql_zap.1.gz = "1$70e109f40751aafcef5541f189e74fb90267bb12fe43895ff2c5f515f4ea5a6b";
    /usr/local/man/man1/mysqlbug.1.gz = "1$5114d1b12c68034a606c7b9fb9083f38e7d570f22e78eb0235a51724549277f8";
    /usr/local/man/man1/mysqld_multi.1.gz = "1$fcfa0ec73ac4f1612f7c223987c7a9f4b1d8bd52493f275e7894e133aae668df";
    /usr/local/man/man1/mysqld_safe.1.gz = "1$d337ea9a88912fe20da311afbd86b7c107ea5cf3206dd27b0e00d448215c6b15";
    /usr/local/man/man1/mysqldumpslow.1.gz = "1$f7e48000246f962109387ee405cc6ef27173e210197dc00ca5270eb9cbab7012";
    /usr/local/man/man1/mysqlhotcopy.1.gz = "1$5ea1ed08826b77eafb7bc51aeaab202db63b214a21ed019ec554a0c108a795b7";
    /usr/local/man/man1/mysqlman.1.gz = "1$7f3ec2c41e5afbf4a4cac7636b65e6ff1dcd96e7ad9c746945fe6d3a0d6ac8be";
    /usr/local/man/man1/perror.1.gz = "1$1bfd293ebf6ee7c22997a6af8c9d0a94d09b104256201d88c4aea5992a3b3ed9";
    /usr/local/man/man1/replace.1.gz = "1$1d5bb152076c1d7bfe4ce4231f16fcbafa114192e325bb514e84c85585d784fc";
    /usr/local/man/man1/resolve_stack_dump.1.gz = "1$91716f84631d037fbda43a517115986e37a3f3894d3bc3454d725bfd0f939344";
    /usr/local/man/man1/resolveip.1.gz = "1$498326c8fd1bc28e2ad96c8163e95e9886f87da6b1c9ee7eab892a8a899a494b";
    /usr/local/man/man8/mysqld.8.gz = "1$6544b5b4adee14a51646207fe18aac47d22505bd2b77f6b6c2df068d09a47609";
    /usr/local/share/licenses/mysql56-server-5.6.43/GPLv2 = "1$8177f97513213526df2cf6184d8ff986c675afb514d4e68a404010521b880643";
    /usr/local/share/licenses/mysql56-server-5.6.43/LICENSE = "1$7e1394d03c5f275a402fe721ff1d1349449ea8602b52af954c76463afcdb6ef7";
    /usr/local/share/licenses/mysql56-server-5.6.43/catalog.mk = "1$b7aedc5ef5005bbd9e813d6d7add21b05e287e97df84649ea6fa7c6c7a8e5384";
    /usr/local/share/mysql/binary-configure = "1$50ffc325d53f0234384eff49bcfee245e0c88d62fbfbb552b51ae33efd91bba4";
    /usr/local/share/mysql/bulgarian/errmsg.sys = "1$ae8b732615c030723ffab842a8cf2f5907d9896f9fabd18c3b50e20686dda751";
    /usr/local/share/mysql/charsets/Index.xml = "1$a23a727f98079f6ce79dbb71bdea2f15a6f11888a86b60c28b57e8c1e71f10cb";
    /usr/local/share/mysql/charsets/README = "1$0af62ce1ae651e980006f2e9d29bd2f24e1cd18c6a0b1914e9c437cc80e990ab";
    /usr/local/share/mysql/charsets/armscii8.xml = "1$373a16485e7fe348f2f3f04b171aed1177704fb270dabb1ae77ed17d1cbe59d7";
    /usr/local/share/mysql/charsets/ascii.xml = "1$f373b6f5ecd0c7f6f68140b623a447f9901b1ab15d6710b739579621d7c5019b";
    /usr/local/share/mysql/charsets/cp1250.xml = "1$4a76017987688e9647df98c6b18d61942e4e010c95dc5607a440bca4c2e6dd6c";
    /usr/local/share/mysql/charsets/cp1251.xml = "1$c3573cec09dd0f4f0ce59559c1ad99666d4560641ebffa63f2d7d1683b35dfd5";
    /usr/local/share/mysql/charsets/cp1256.xml = "1$8511acfe37a3c39d846782023c1b489fda37b0bcfc63d30ecd619985e1fbb418";
    /usr/local/share/mysql/charsets/cp1257.xml = "1$076e82a5a50c6319843ea15140af9c7a538f3d27840fbfa86654f1e4beb73a2f";
    /usr/local/share/mysql/charsets/cp850.xml = "1$1eddf3a0157f1de81daa5db4a3b2901c36ac62cdbc99213481e7cf2266c89305";
    /usr/local/share/mysql/charsets/cp852.xml = "1$04083eadefc4c7787da40011078250fc8c7dcfb58fc3a6576e908e0be3319ff5";
    /usr/local/share/mysql/charsets/cp866.xml = "1$dfc494ee19d07b886af7415cf70d28e8f5ec50c909fe32f237455fc0f7cc00aa";
    /usr/local/share/mysql/charsets/dec8.xml = "1$3123272469231568059cbe8be8b9a4a944ded2a68e4dfde1a86970c952d587c2";
    /usr/local/share/mysql/charsets/geostd8.xml = "1$96b3eb14149e48e95d610cf2f595ae8261ecb7d73a4ff62d3be3c6444e8518e6";
    /usr/local/share/mysql/charsets/greek.xml = "1$baa269df50d7b38aec698562a3f0014310b16c663dddd954731938878104bbdd";
    /usr/local/share/mysql/charsets/hebrew.xml = "1$9d3b487887d82576949911e495b85d23f1bc7c65a1a5c1ce96b8ed82b57bbcfe";
    /usr/local/share/mysql/charsets/hp8.xml = "1$31bbd31ea422d32bba0ac358a94cb3a9fd6cb1e60397d9e3ac6b0b0fef193150";
    /usr/local/share/mysql/charsets/keybcs2.xml = "1$06a0a810115bd4a101b35858b489381871940de6e57e298843ec85297310db1d";
    /usr/local/share/mysql/charsets/koi8r.xml = "1$d4ccdb7c8d77f98a1daa9a361dc3e63281941617b9d026578bd30b7e91a56063";
    /usr/local/share/mysql/charsets/koi8u.xml = "1$7c6c51ee54dae618ccfae63eb51aae2398808107e94ba659efac74eb072a2a4b";
    /usr/local/share/mysql/charsets/latin1.xml = "1$5f673506668bbf2be9e8fccd843cbf284d13e84a38351b52bd9319265e27cb19";
    /usr/local/share/mysql/charsets/latin2.xml = "1$f430c3f85731a238317aedcdedd36f794547c5238b82f614d117abf2e3deabb7";
    /usr/local/share/mysql/charsets/latin5.xml = "1$673c4308fe92e5da246551407d6fc10a8f5b35ad2c2c0775f8a047519d6582eb";
    /usr/local/share/mysql/charsets/latin7.xml = "1$6b0397f4ffb8dca69319893093405fc47cd9da6c92175b339137c142bf2e5ed8";
    /usr/local/share/mysql/charsets/macce.xml = "1$18394e078c95da22db6df3f28c0f21bffa146bbc98bb3526af553a8c40b6d660";
    /usr/local/share/mysql/charsets/macroman.xml = "1$0f39efaf0718f6188ecf31daa36681f7de33bb86129c53d08d11f7ce3a66715a";
    /usr/local/share/mysql/charsets/swe7.xml = "1$1508f42a32fbf1c8943a25edbace1064ee4dd1b50b71313d94237d9c636976a1";
    /usr/local/share/mysql/czech/errmsg.sys = "1$40ef5e2d0f7bb13d83fff76e1f02447a9b25e25198c32aa6629555a58dcf8471";
    /usr/local/share/mysql/danish/errmsg.sys = "1$a8703c7e376c43d11585f827da0bc560058f89605fdd81a8231031cfcb2ad0df";
    /usr/local/share/mysql/dictionary.txt = "1$d031a0f90d77595abe02112adf69a86560e3168ba379fd450176a8e070763077";
    /usr/local/share/mysql/dutch/errmsg.sys = "1$e32bddcb568463868d780a32c6e9c698e6b46e63f62cb78dc312ad307fc5211f";
    /usr/local/share/mysql/english/errmsg.sys = "1$2939d1f848e7e49fe2c1f84a9cf5836ee2ce2c266ad51f56e7feeb179b390f96";
    /usr/local/share/mysql/errmsg-utf8.txt = "1$9a5f5bb3da1b8b4c41b358118177548b16037cd977067bc6bb02aa9dc71e3ab8";
    /usr/local/share/mysql/estonian/errmsg.sys = "1$491ec4bc7d45d7bfa2c4cb3deab570bdd438eaf6ff21c1a576ff2608b5ae9f3f";
    /usr/local/share/mysql/fill_help_tables.sql = "1$12cf364ea557f7053eced72221c82b09f37701edad796c7c14ab003648fc9562";
    /usr/local/share/mysql/french/errmsg.sys = "1$b038562d4bb25ca63e07dc94d5735bbb9d8de15455915b9b63db8e1eaadbe79e";
    /usr/local/share/mysql/german/errmsg.sys = "1$01e27208d352b3938233c15c66626b223c17878a915984062087337229ec4c1b";
    /usr/local/share/mysql/greek/errmsg.sys = "1$05f7ac61d2e2943b62f03866d4cd5f41e6c53d254bcf2c4f7ec96e4143110447";
    /usr/local/share/mysql/hungarian/errmsg.sys = "1$f2b534c47b805c252b95d7e66f370f0403c10d26dd511db55409aaf3fc3a422d";
    /usr/local/share/mysql/innodb_memcached_config.sql = "1$8604887a7a1aa1e79a0a774dc0d00a5d4504bf8f87e82f8425c2260dbb471d1b";
    /usr/local/share/mysql/italian/errmsg.sys = "1$a4efcdf571beed267260da45d4a865a8458019a6143b84fd33c66c3ed63e1e5b";
    /usr/local/share/mysql/japanese/errmsg.sys = "1$60959ea3d6cafa593003a9766ff0939172d8312855d3d04ca90e616b823d2069";
    /usr/local/share/mysql/korean/errmsg.sys = "1$225d6a940ad52ae5be756d68d914b32ef6381835450c133ce0967d98ba72c3eb";
    /usr/local/share/mysql/magic = "1$c1a9bb09d1872706da59ef362a9b69fcc04d9ed961f876a735b00d85199bbe9c";
    /usr/local/share/mysql/my-default.cnf = "1$48d312c3369af5a1b7691ad6f3ac3773f7f278373195fca5117b79bfaf6fd554";
    /usr/local/share/mysql/mysql-log-rotate = "1$8c5987997d3ef56d926cbb6984adddcb65fac3880e001e6ee3997b4403e8d0f1";
    /usr/local/share/mysql/mysql.server = "1$47ade497c796230b318419eca16feda2f84e73d13f43a910a0081286b15d9d4b";
    /usr/local/share/mysql/mysql_security_commands.sql = "1$84105111cd2844948fbf8d01cbb9346fb31e5df8b675e2866bf9975f9021d1c8";
    /usr/local/share/mysql/mysql_system_tables.sql = "1$08291881e0ee68724756563ac59711904aed49cbf1928050cba3fbf192b551bc";
    /usr/local/share/mysql/mysql_system_tables_data.sql = "1$b8f38dca148bee4b8ca286d1ccbfb2bbdf967a3271dd0f109794281c375e5989";
    /usr/local/share/mysql/mysql_test_data_timezone.sql = "1$ddd2e646ed4bd2ab5fae9de47e5df51f2fd638ea0ecd9c5758c4f886f4f85fef";
    /usr/local/share/mysql/mysqld_multi.server = "1$6a784dc307a8d540759d9a5f1fe96f06714435db47c7aef0fcb94c36d73a8e48";
    /usr/local/share/mysql/norwegian-ny/errmsg.sys = "1$16e8ff4bb42222fb3dc65b316d9420384561b4169633bb75746363663eab8038";
    /usr/local/share/mysql/norwegian/errmsg.sys = "1$e5b775a2d35681c75fe0323902d856b7728eaade76645a05c202b5836ffffa38";
    /usr/local/share/mysql/polish/errmsg.sys = "1$f8bfd1a8e049c40cd331993542656dd68a8f384bcc85a0f20e81a4cff1542c84";
    /usr/local/share/mysql/portuguese/errmsg.sys = "1$e4b97b77c037bb5e308ddbeb9b66ad5e77f99d0b94718ffcd7504f810c8a1ea8";
    /usr/local/share/mysql/romanian/errmsg.sys = "1$01593f9b690fd8f619a022aafcdcfd1815702c767df0642711699a814ab27243";
    /usr/local/share/mysql/russian/errmsg.sys = "1$a8fe7c38e48dd7a67edb9f476fa7f84ddb4278461f1397d70b485ae53068c0b8";
    /usr/local/share/mysql/serbian/errmsg.sys = "1$c3990f742f4af781adcf1cc7275e3740c2d6944ef52dee0cfcf0e89c84e61c7e";
    /usr/local/share/mysql/slovak/errmsg.sys = "1$4f7a301b10888cf1de21429dd51a37b98ec24dd5f43813042b2187710ef973fe";
    /usr/local/share/mysql/spanish/errmsg.sys = "1$25c0b4abb860ccfef6005451ea95ba9ffbd03b0138173beaf494a3c6cda65ef2";
    /usr/local/share/mysql/swedish/errmsg.sys = "1$6db0cad1dd8f957b26b6a04427bccf85c33fad007cfea396aea4a0bedf92100a";
    /usr/local/share/mysql/ukrainian/errmsg.sys = "1$bce9abbe3c24cebc55cc82cdf30f05c54b5bb8c3fc38fed6ee51a94c05a759f3";
}
directories {
    /var/db/mysql_tmpdir = "y";
    /var/db/mysql_secure = "y";
    /usr/local/etc/mysql/keyring = "y";
}
...

If it doesn't, does that mean that the original data is likely to be intact and only the DB engine and configuration are gone?
If the package deletion did not touch your data it should still have the latest state like touched last by the MySQL server.
Your data is probably still safe there.

If the packages are reinstalled, how do I restore the data back to the DB? Presumably the directory presence isn't sufficient. Online manuals typically explain the process of importing previous DB dumps... not the case here.
As the package would just install whatever was deleted, I think theoretically you should be able to pkg install mysql again (make sure it's the same version!!!) and then just start the server you should be good to go.
Before trying it, make a backup of your data just in case!

You can see in /var/log/messages exactly what packages were deleted and then reinstall them. There must have been a reason for the removal though. Possibly another package conflicts that particular mysql version.
 
The package removal should do nothing to your data -- otherwise upgrades would kill data (since they involve a remove / install process.)

As noted above, make a backup of your db (file copies are fine if the database is not running) in /var/db/mysql (by default, unless you changed it.)
Then pkg install mariadbNN-server ( grep 'pkg.*maria' /var/log/messages to see what you had) and service mysql-server start.

It may have been uninstalled due to something else pulling in mysql*-server, which conflicts... if that's the case, you'll need to run that down and possibly build the corresponding package from ports with your desired DB (with something like DEFAULT_VERSIONS=mysql=10.2m in /etc/make.conf)...
 
Thanks everyone - I'll give this a go and report back. Re backup - this is the obvious thing to do, but... 😄 nope, I have no backups. This is because that jail is still very much an experimental platform. All of the data is stored on a single drive on UFS. Its use is stabilising and I'm planning on migrating it to new hardware and ring-fencing, backing up, ZFS pools, etc. like you would in a proper production environment.
 
Confirmed - your solution worked. Didn't have to do anything but reinstall packages. You guys are better than any commercial support service! :) Thanks.
 
Confirmed - your solution worked. Didn't have to do anything but reinstall packages. You guys are better than any commercial support service! :) Thanks.
You could pay us if you want to, no problem on my side. :p
I'm glad it worked.
 
Back
Top