I used to have mysql 5.6 server. I backed up with like this command.
mysqldump -u Myuser -pMypasswor Mydatabase > C:\backups\Mydatabase.sql
I removed Mysql 5.6 and installed 5.5 version.
Now I try to restore my database but it fails. Firstly I tried this
mysqldump -u Myuser -pMypasswor Mydatabase < C:\backups\Mydatabase.sql
Afterwards on Cmd Connected with
mysql -u Myuser -pMypassword
Mydatabase < C:\backups\Mydatabase.sql
I got this error
ERROR:
Unknown command '\a'.
ERROR:
Unknown command '\m'.
ERROR:
Unknown command '\I'.
-> ;
I googled but I cant solve my own
Any idea is appreciated
Related
I am trying to backup and restore the cleardb database. I was trying to backup to my local computer first and then restore it. However, I am not able to create a backup
mysqldump -h us-csdr-fern-sds-03.cleardb.net -u sdloremipsum5 -p ipsum <my_dev_dump.sql
I am trying this from mysql shell but I get
Syntax Error: Unexpected Identifier
use
mysqldump -u username -p databasename > filename.sql
to export and
mysql -u username -p databasename < filename.sql
to import
Please refer: http://dev.mysql.com/doc/refman/5.6/en/mysqldump.html
Duplicate: Syntax error in mysqldump command
Answer: https://stackoverflow.com/a/18502626/10368530
I'm trying to move a MySQL DB from version 14.14 Distrib 5.5.50 to another machine with 14.14 Distrib 5.7.13 (both machines are Ubuntu, 14.04 and 16.04 respectively)-
I've always managed to do it with these commands:
1) Backing up on origin-computer:
Users:
$ MYSQL_CONN="-uroot -ppassword"
$ mysql ${MYSQL_CONN} --skip-column-names -A -e"SELECT CONCAT('SHOW GRANTS FOR ''',user,'''#''',host,''';') FROM mysql.user WHERE user<>''" | mysql ${MYSQL_CONN} --skip-column-names -A | sed 's/$/;/g' > ${TEMP_DIR}"/"${MYSQL_DIR_NAME}"/users.sql"
Databases:
$ mysqldump -uroot -ppassword --all-databases > ${TEMP_DIR}"/"${MYSQL_DIR_NAME}"/databases_TMP.sql"
2) Restoring on destiny-computer:
Users:
$ mysql -uroot -ppassword < users.sql
Databases:
$ mysql -uroot -ppassword < databases_TMP.sql
And it has always worked for me until now.
This time, no matter the order in which I take these steps or any combination/modification on the parameters, it is not working and I can't figure out why it's not working.
Every time I finish the process, when I launch the MySQL Workbench and click any user, inmmediately I get this error message:
"Unhandled exception: object of type 'NoneType' has no len()"
I have no clue what can I do to solve it, so any idea will be really welcomed.
Just in case someone else had the same problem:
Using the mysqldump command instead of the one I posted in my question worked fine:
$ mysqldump -uroot -ppass --all-databases > databases.sql
However, because of MySQL versions on both computers I also had to go through this other problem:
MySQL unknown column 'password_last_changed'
And finally now I have everything working again.
I have a mysql dump file named dblp.sql
I am trying to restore it to database named DBLP
I tried the command:
source dblp.sql
mysql -u root -p -h localhost DBLP < dblp.sql
And those did not work. I keep getting an error SQL syntax on the second command. And failed to open file on the first command.
Any help would be really appreciated thank you.
Try restoring the data using the 'force' flag. One of the server's I helped maintain did not like to restore it's dump'ed data.
mysql -u root -p -h localhost DBLP --force < dblp.sql
try
mysql -hlocalhost -uroot DBLP < dblp.sql
Doing
mysql -uroot -p -e source F:\code\mysql\mysql-data\myHfs\test.sql
gives : ERROR 1049 (42000): Unknown database 'f:\code\mysql\mysql-data\myhfs\test.sql'
But if i go inside the mysql command promt with just the mysql -uroot -p and then type in source F:\code\mysql\mysql-data\myHfs\test.sql , i get the proper output.
the content of the above file being :
use gregs_list;
show tables;
select * from clown_info;
Edit : doing mysql -uroot -p < "F:\code\mysql\mysql-data\myHfs\test.sql" -t seems to solve the problem.
http://dev.mysql.com/doc/refman/5.0/en/mysql-batch-commands.html
mysql -uroot -p < "F:\code\mysql\mysql-data\myHfs\test.sql"
I'm having some difficulty with mysqldump. I locked my tables and ran the following command:
mysqldump -u user -p password databasename using my actual password and database name.
When I run this from mysql I get a 1064 error that says there is an issue with my syntax. I've also tried running the command from terminal (outside of mysql) and receive a 'command not found' error message. I'm not entirely sure how I should be doing this (the explanations I've found so far have been vague).
Thanks for the help.
The mysqldump is a program, it cannot be executed from the mysql console. Run it from the shell.
Have a look at the syntax reference.
--user=user_name, -u user_name
--password[=password], -p[password]
As you see there is no space between -p and password. So, your command line should be like this:
>shell mysqldump -u <user_name> -p<user_password> ...
or
>shell mysqldump --user=<user_name> --password=<user_password> ...
You are missing the target backup file name:
# [mysql dir]/bin/mysqldump -u username -p password --databases databasename > /tmp/databasename.sql
MySQL Commands
the correct syntax is
mysqldump -u [username] -p[password] [databasename] > [backupfile.sql]
you should add the > backupfile.sql
the other error is believe your system doesn't recognize the mysqldump path and you should go directly to bin folder from mysql installation.