Link to home
Start Free TrialLog in
Avatar of ConsulmexLA
ConsulmexLA

asked on

How to access a MySQL data base from a backup?

Hi guys,

I have a MySql data base in a server that I manage from a vb6 app.
I need to put the same data base & app. in another computer-A separately, computer-A won't access the server, ( I allready Install Mysql, MyODBC & my app. in computer-A)

I have a backup of the data base from my server that I want to use in the computer-A.

My question is:

How to put that data base (from backup) in computer-A, then I can access it from my app.?

Thank you experts.
Avatar of absarahmad
absarahmad

if ur using mysql frontend, export the database to a textfile, copy the text file in the Computer-A and run the script in the text file, or import the text file.
In this way the whole database will be copied.
If you have access to the actual mySql directory, the database is stored as files.  In the past, I've just copied those files (and even the whole directory) to my new location.
ASKER CERTIFIED SOLUTION
Avatar of absarahmad
absarahmad

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
its *very* important to lock the tables before copying them, unless you are the only person using the database and you are certain there are no queries taking place.

imagine a query which updates 50 rows with a new value - if you copy the database files during this operation, then the copy will be inaccurate, and only say 25 rows will have been updated in the copy

LOCK TABLES table1 READ, table2 READ, table3 READ

this will lock the tables you specify and only allow READ access. any query which attempts to write to the database will be put on hold.

FLUSH TABLES table1, table2, table3

to ensure any unwritten (cached) data is written to disk

*now* you are ready to copy the files. as mentioned above, the files are stored in the mysql/data folder, with a folder for each database. simply copy the files to the new location

then

UNLOCK TABLES

to restore them to read/write operation


Avatar of ConsulmexLA

ASKER

Hi guys,
I must doing something wrong, I allready copied the database to computer-A at the following address: "C:\MySQL\Data" but nothing happens, when I open the MySQL Control Center to see the data base, I can't see anything, so when I run my app. an error message appear "Can't connect to MySQL server on localhost".
I made a little app. to change the windows registry, when I put the parameters to connect to a server, it works fine but when I put it to connect to localhost, the errror message appears, what else do I need?
Nobody answer my question?
doesnt sound like mysql is running on that machine.
Thank you guys,

I allready solve the problem, What I did was I opened the WinMySqlAdmin then I went to my.ini Setup and then changed the parameters #bind-address=LocalHost.

So, in that way I can see the data base that I copied.

Thank's