I used to rely on XAMPP in my Kubuntu 18.04 which located in /opt/lampp
. I uninstalled the XAMPP and had a whole folder backup in this directory before that, and eager to install all the LAMP stack individually, which i installed apache2, mysql-server, and phpmyadmin after that.
The thing is, i want to import my databases from my backed up XAMPP folder located in /opt/lampp/var/mysql
which consist of all my databases with tables in .frm
and .ibd
format, which is obviously exist, to my current installed mysql package database location in /var/lib/mysql
.
After i moved those databases, i opened phpmyadmin to make sure the dbs imported correctly, but i only saw the database without the table inside the database. How come? What needs to be done to restore the tables inside?
You can't just copy database files from the datadir ( /var/lib/mysql
in your case). A proper MySQL/MariaDB backup is to generate.sql files which you can then import independently. It's not possible to selectively restore certain databases, due to the way certain files are managed (such as ibdata1 and perhaps others such as logfiles).
What I would try, and may or may not work, is this (the usual disclaimers about backups apply, I'm not responsible if your system becomes inoperative or catches fire, etc):
mysqldump
command-line utility that ships with MySQL/MariaDB).mv /var/lib/mysql /var/lib/mysql-current
)./opt/lampp/var/mysql
), to /var/lib/mysql
./var/lib/mysql
out of the way (or if you're brave, delete it entirely)./var/lib/mysql-current
to the original location in /varlib/mysql
That's it — you should now be all set with your original data in your new database.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.