patternsqlMinor
Restoring a database backup to a local machine in MySQL
Viewed 0 times
localrestoringdatabasemysqlmachinebackup
Problem
I have downloaded my
I want to restore the back up in my this machine. I used:
Where database is my new database name in this machine. My confusion is that my
.sql file of my database server. It is in the D: drive of my Windows machine.I want to restore the back up in my this machine. I used:
mysql database -u root < backupfile.sqlWhere database is my new database name in this machine. My confusion is that my
backupfile.sql is in the D: drive and thus I guess there is error.ERROR 1064 :You have an error in your SQL syntax;Check the manual that corresponds to your MySQL server version for the right syntax to use near 'mysql database -u root < backupfile.sql' at line 1.Solution
You should login to mysql like this
Next, select the database you want to load the data into
Then, run the script
Give it a Try !!!
C:\> mysql -uroot -p
Enter password:Next, select the database you want to load the data into
mysql> CREATE DATABASE IF NOT EXISTS mynewdb;
mysql> USE mynewdbThen, run the script
mysql> source D:\backup\backup.sqlGive it a Try !!!
Code Snippets
C:\> mysql -uroot -p <hit enter>
Enter password:mysql> CREATE DATABASE IF NOT EXISTS mynewdb;
mysql> USE mynewdbmysql> source D:\backup\backup.sqlContext
StackExchange Database Administrators Q#40579, answer score: 8
Revisions (0)
No revisions yet.