Okay, heres a easy one for all you mysql folks out there:
Our Win 2003 server crashed last night (durring installing of windows updates). We were able to restore old data from backup, but we miss 22 hours of data. We cannot start windows and therefore not access the data through mySql admin which is the program I use normally to make backup. We have however been able to copy all data to external harddisk.
How do I access these data usning MySql Query browser and MySql Administrator tool?
If you don't have binlogs enabled, or cannot be sure at which point your backup snapshot was made trying to get the datadir running in another server is about your only option. (Which for maximum possibility of recovery should be as much like the original as possible in MySQL version and other environmental data).
If you do have active binlogs, look at this manual
Please let me preface this by saying, I'm not a Windows administrator, so permissions issues are outside my expertise.
Setup a new machine running the same version of MySQL.
Create a new folder and copy your backup of mysql data to that folder, including the mysql database.
Edit your my.cnf file on the new machine to change the following:
# set your data directory
datadir = c:\path\to\new\datadir
# just in case
skip-slave-start
# optional
skip-networking
# if this is an emergency and you need to go through password recovery
skip-grant-tables
Restart MySQL and watch your error log for output. It should start up and you can simply sign in as 'root' with no password and do what you need to do to backup your data.
Related
I have a dead hard drive. I've connected it with SATA to USB IDE and can recover files. Also the filesystems looks good. How Can I get a dump of database from that hard drive. The laptop I'm using also has mysql installed in it. I'm using xampp. I've tried the following command.
G:/xampp/mysql/bin/mysqldump -u root -p uma > D:/umaoldbackup.sql
This is not giving dump of a latest data. And I think it's giving dump from my local computer.
Please help.
Correct, mysqldump connects to the running MySQL Server process on your local computer, not the data on your sick hard drive.
MySQL client applications like mysqldump do not read the data files directly. They connect to a MySQL Server process and make requests for the data. Before you can access that data, you need to restore the data files to the data directory of an instance of MySQL Server.
Stop the MySQL service.
Copy data files to the data directory of your MySQL service. Move any existing data files to someplace else that is safe, if you want to bring back that data after exporting your umaoldbackup.
Start the MySQL service so it can read the files in that data directory.
You should probably get someone to do this for you if you don't know how to start and stop services on Windows.
Re your comment about where is the data directory...
I'm not a user of Windows or XAMPP.
It's probably actually C:\xampp\mysql\data according to What is the exact location of Mysql database tables in XAMPP folder?
But you can confirm that by connecting to your current MySQL service with a client and running the following query:
SELECT ##datadir;
I have a file called database.dmp that is the mysql dump from the server last night. User is probably root.
I want to create a local copy on my computer 'MARK-PC' (I definitely do not overwrite the live database on the server).
What is the best command to do this?
1a. Can I use that command from the microsoft windows command prompt? I am not that familiar with the mysqldump command line and don't want to screw anything up.
Will I need to have root access?
If I set it up with another user/password, what issues will I run into if any?
For SQLite, the program directly put the database information - schema/data into a file.
In command line prompt, it's
% sqllite3
So How about for MySQL database? Even for a local usage, I need to set up a client-server login to access the database. Anyway, the data has to be put somewhere on the disk to take some space.
More specifically, how to configure the MySQL data storage location? If I need to move the MySQL data to another directory or disk partition, how to proceed?
Change the datadir value in my.cnf file of your MySQL installation
If you are in Windows, probably you will find this file in C:\Program Files\MySQL\MySQL Server 5.1\my.ini or where ever drive your MySQL installation in
If you are in Linux, probably you will find the file in /etc/mysql/my.cnf
You could check here for more info
I am using MySQL 5.5 and MySQLWorkbench on Windows7. I have successfully created a database on my C: drive but I want to move it to my E: drive. I stopped the mysqld daemon and edited the my.ini file to change datadir="C:/ProgramData/MySQL/MySQL Server 5.5/Data/" to datadir="E:/MySQL/data/". I copied the data from the C: location to the E: location.
I can start the mysqld process, but the database I created does not appear. Would anyone have any explanation as to what I am doing wrong?
Basicly you would like to copy all the contents in the old directory to the new directory. Make sure that while doing this you don't also copy binlogs (if any, they look like mysql-bin.001 etc. and also don't copy mysql-bin.index because that contains real path reference to the old binary logs). Once you do that, you should be able to restart the mysql daemon and login to see the databases.
PS: not tested, but should work.
When I was trying to move my database I ran into the issue where windows didn't have the same permissions on the new data folder as the original. You may check that the correct user(s) have access to the new folder by going to the properties of the folder then selecting the security tab.
As I wanted my innodb database to sit on another partition, I stopped MySQL from the MySQL Workbench. I copied my innodb database ibdata1 as well as 2 log files which MySQL automatically created in my C:\ProgramData\MySQL\ folder to a new folder on my E: partition. I added the following to my.ini:
innodb_data_home_dir = "E:/MySQL Data"
Now, when I start my database, all changes are made to the ibdata1 in the E: drive.
Dump your database to disk using this tool http://sourceforge.net/projects/mysqlbutool/ Then restore it to the new server using this tool http://www.webyog.com/
I would like to change the database files location of MySQL administrator to another drive of my computer. (I run Windows XP SP2 and MySQL Administrator 1.2.8.)
--Under the startup variable --> General Parameters --> I changed Data directory: from C:/Program Files/MySQL/MySQL Server 5.0/data to D:/....., but after I stopped the service and restarted it, the following error appeared:
Could not re-connect to the MySQL Server.
Server could not be started.
Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist
Has anyone else had this problem?
Normally it works like this:
shut down MySQL
change the [mysqld] and [mysqld_safe] datadir variable in the MySQL configuration
change the basedir variable in the same section.
move the location over
restart MySQL
If that doesn't work I have no idea. On linux you can try to move the socket to a new location too, but that shouldn't affect windows. Alternatively you can use a symbolic link on *nix what most people do I guess.
In Windows
Navigate to C:\Program Files\MySQL\MySQL Server 5.4\ and locate the my.ini file
Find the SERVER SECTION and go to approx line 76 and modify the datadir line to where you want your MySQL application data to be stored
Now navigate to C:\Documents and Settings\All Users\Application Data\MySQL\MySQL Server 5.4\data\ and copy and paste the mysql folder into your new location.
Restart the MySQL Server in Control Panel > Administrative Tools > Service
You also have to manually modify mysql's configuration (usually my.conf)
MySQL Administrator cannot be used for tasks like this. It is merely a tool for looking at MySQL servers, despite its name. Relocating data is described in many MySQL tutorials and in the manual IIRC. But basically it's just moving the data to a new location while the server is shut down and then correcting the paths in the servers config file.
After that you should be able to restart the server and connect MySQL Administrator to it.
Make sure you give the Network Service Full permissions in the security tab of Windows Explorer options. If the server can't read/write etc. to the selected folder the service will either not start or it will attempt a start and shut right down.