I need a single InnoDB database to be used by a Linux and a Windows MySQL installations (as I boot my PC to Linux or to Windows). Would be great if I could move the same database to a different PC. Importing/exporting data is hardly an option as the database is huge (over 4 GiB - easy to copy, but pretty long to export/import). How can this be achieved?
You should then install the MySQL database on the windows partition, and get the path to the database folder
In Linux, MySQL saves its data in "/var/lib/mysql/" so go there and create a symlink to the folder in the windows partition using the following command
ln -s /path/to/database/on/windows/ /var/lib/mysql/databasename
you need to be root to run this command, or use sudo.
This will make the MySQL server on both Operating systems see the same database folder.
NOTE: you should do some testing to check if this is a reliable solution, and if you are doing a mission critical project you should follow a more reliable setup.
Related
I've read several posts on this forum and others and still can't read some MYD/MYI/FRM files which contain data that I want to import into SQL Server.
I stopped the MySQL service at the client location and copied all the files (the same way that we would do with SQL Server).
I have installed the most recent MySQL ODBC connector, MySQL engine and MySQL Workbench on my Windows 10 PC. The engine is running and the ODBC connector is configured with a username and password. Using the workbench, I have been able to successfully log in.
I created a MyTest database which created a C:\ProgramData\MySQL\MySQL Server 8.0\Data\mytest folder.
I stopped the MySQL service and copied MyData.MYD, MyData.MYI and MyData.FRM to the mytest folder.
I restarted the MySQL service.
But if I run a "Select * from mytest.MyData" query in the workbench or using the MySQL 8.0 Command Line Client, it keeps indicating that the table mytest.MyData doesn't exist. Now, I read that it might be appropriate to run a CHOWN command but I don't know what if syntax would be different for a Windows system and whether this command would be executed directly from a Command prompt.
Any assistance would be greatly appreciated. Thanks!
Older versions of MySQL let you get away with that for MyISAM tables, but MySQL 8.0 introduced a whole new implementation of "data dictionary" which is a meta-database maintained internally, and it has a bias for InnoDB over MyISAM. So I would believe that moving files around ad hoc no longer works as it once did. To move tables from one instance to another, you should really do the export and import steps properly.
For InnoDB, you may use transportable tablespaces. At least you don't have to do a full data import that way, but it takes a few more steps than just file copy.
P.S.: I haven't used MyISAM in many years anyway. I prefer my database to support ACID properties, and MyISAM does not support any of the ACID properties.
Is there any way where I can take a backup of some files/folders to take the backup of all my Mysql databases. I am using Acronis Cloud Backup tool and I dont find any option where I can backup mysql database. It is either Drive/Folder or entire machine. Need an approach without using mysqldump. Instead I am looking at directory/files backup
Also it is NOT a linux machine so cron & shell script cannot be used. It is windows 2016 server.
What is the best approach to backup multiple mysql databases which in emergency can be restored reasonably fast and accurately.
Thanks
Kalpak
You can backup the complete folder
C:\ProgramData\MySQL\MySQL Server 8.0
And after reinstalling you copy all folder/files back.
I had to do it last week, so i am sure that it works, but you need all files.
And this is not incremnetal.
I have a mySQL database on my Windows PC. I'm pretty sure I've found the relevant files, namely the following:
formula.frm
formula.ibd
db.opt
What is the natural way to inspect, edit, and generally play with the contents of these files?
You do not view the binary database files directly. MySQL is a service that you connect to with a client and then perform SQL commands. You will need a client (such as MySQL Workbench) to work with the server.
MySQL Workbench is the GUI tool that allows you to connect to a MySQL database and perform actions on it including querying and creating/modifying the various parts of the database.
MySQL Workbench intro: http://dev.mysql.com/doc/workbench/en/wb-intro.html
Getting started with MySQL: http://dev.mysql.com/doc/refman/5.6/en/tutorial.html
There is also the command-line utility that is included when you install the server. It will be in the BIN folder of the MySQL install directory.
Command-line client info: http://dev.mysql.com/doc/refman/5.1/en/mysql.html
Use a tool like Mysql Workbench to connect to the DB. You do nothing directly to the files. You connect to the service and use the DB.
William, it sounds like your question is "how do I take mysql binary files and turn them into something usable on my machine?". If that's the case, you'll want to first install MySQL on your machine if you haven't already. Then you might have a look here for how to recreate a database from a .ibd file.
I have a very odd situation going on here. I had a linux box running ubuntu 8.10 and MySQL server with a Wordpress installation on it hosting an internal blog for our company. The machine that this was running on has crapped out, but I was able to put the drive into an enclosure and gain access to the files and recover the MySQL data folder.
We are mostly a Windows company and I have very limited linux experience. Before this machine crashed we were experimenting with moving this blog to a Windows Virtual Machine running PHP for IIS; and we have an older copy of the Wordpress database up and running on MySQL 5.1.
I am currently trying to retrieve the latest data from the linux MySQL data folder and import it into the current database but I am having problems.
Problems so far:
I do not know what version of MySQL was installed on the linux box
I see ib_logfile0, ib_logfile1, and ibdata1 on the linux MySQL data folder, but am not sure if it was truly running InnoDB or not as I also have .frm, .myd, and .myi files in the wordpress folder
If I can figure out the version of the linux box MySQL I might be able to create a virtual machine to run linux and MySQL so I can copy the data folder and then do an export dump; unless someone else knows of an easier way to get the data into my current database.
Any help or guidance on this issue would be greatly appreciated.
Thanks, Nathan
Look for "mysql_upgrade_info" file.
I have a hard disk that MySQL 5 has been installed on it (this hard disk belongs to another PC with Windows XP) and I've connected it to my PC. How can i copy its MySQL data to another MySQL 5 ??
thanks in advance.
you can try this.
Shut down both mysql server.
Locate the mysql data directory (e.g. /. If your database use myisam as engine you will find for any database a folder. In this folder are the files for each table, indexfiles and datafiles. Copy the folder to the data directory on your pc.
Start your mysql server.
PS: Check the version of both servers.
Or you can use mysqldump this is an command line utility for mysql. After export copy the export file to your server and use this command:
mysql -u<username> -p<password> < <exportfilename>
Kind Regards