I just logged into my EC2 via Putty on Windows and I got into my RDS instance and into one database I had created. Then I try to import a SQL dump from my machine with the following code which results into an error.
mysql> source C:\Users\guru\Downloads\latest.sql;
ERROR:
Unknown command '\U'.
ERROR 1064 (42000): 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 'source C:\Users' at line 1
ERROR:
Unknown command '\D'.
ERROR:
Unknown command '\l'.
ERROR 1064 (42000): 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 'uru\Downloads\latest.sql' at line 1
The file exists in my Windows machine. Please help me resolve the error.
As datasage mentioned, you would probably be better off working from your EC2 -> RDS instances. If you really want to work from your local machine, though:
Install MySQL for Windows: http://dev.mysql.com/downloads/mysql/
Add the parent directory of mysql.exe (the mysql command line tool) to your path environment variable.
Try the following in the command prompt. You could use powershell also, but you would need to wrap this statement in cmd /c "mysql etc..." because powershell handles redirection a little differently.
mysql -u myUser --password=myPass -h rdsEndpoint myDB < C:\Users\guru\Downloads\latest.sql
This procedure would also be useful to know if you have need for a Windows EC2 instance.
As an aside: extracting data from RDS to your local machine can get pricey, especially as your database grows. If you're just doing this as a backup solution, then you may want to look into Snapshots or automated backups. If you are doing this to replicate your RDS environment you could also transfer your data directly from RDS to your EC2 instances, which is free if both instances are in the same availability zone.
I found a very simple and user friendly solution: Downloaded SQLyog https://www.webyog.com and fed in my ssh details for my ec2 and my MYSQL log in details. I ended up accessing a my database using this GUI tool that has all the options for importing and exporting data as easy as on localhost/phpmyadmin
Related
Trying to import a very large database file.
Windows Apache PhpMyAdmin.
USE test;
source somefil.sql;
I get a syntax error:
"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 'source somefil.sql' at line 1 "
There is no such command in mysql server as source. This command is specific to mysql own command line client, which is also named mysql, therefore it is not available in phpmyadmin.
Copy-paste the contents of the sql file into the command window of phpmyadmin and execute its contents directly from there. You may have to increase the php max execution time parameter, if the import file is truly big.
However, I would use the command line client to execute a really big sql file because phpmyadmin is not suitable for that.
to restor backup of my datebase I use command like that
from your os command promt :
mysql -u youruser -p yourdatabasename < yourfilewithfullpath.sql
Actually source command is used from command prompt so Use below steps-
Go to command prompt-
connect mysql
now use below command-
source d:/backup/somefil.sql;
I'm a MySQL/WAMP newbie attempting to set up timezones so that I could follow along with a course on the topic, but then I started having troubles when the instructions I was being given didn't correspond to the info on the MySQL page from which I was to download the setup file, http://dev.mysql.com/doc/refman/5.7/en/mysql-tzinfo-to-sql.html.
Can anyone tell me why, when I attempt to run this command from the mysql command prompt:
mysql -u root mysql < C:/timezone_posix.sql;
I get this error:
ERROR 1064 (42000): 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
BTW, I've tried that with both forward and backward slashes, with and without quotes, etc., from my WAMP 5.6.17, MySQL command prompt, and the file in question is the posix (not isam) version that corresponds to the MySQL version on a windows machine.
You should be running that from the regular command prompt, not inside the mysql program, since it runs the mysql program. So it should be at the C:\ prompt.
Or you could use the mysql source command to read from a file:
mysql> use mysql
mysql> source 'C:/timezone_posix.sql'
I have a MySQL database which is hosted in Azure, and I have MySQL Workbench installed on my laptop. I want to do some importing from a CSV file located in my laptop, but whenever I try to that, I get an error message saying:
The used command is not allowed with this MySQL version
I did some online searching, and I found out that I need to run the following command:
mysql -u myuser -p --local-infile somedatabase
But, I don't know where I have to run it, and how, while as I said my database is hosted in Azure.
mysql is just the commandline executable of the MySql client. And most probably it is even part of the MySql workbech - just check the MySQL Workbech working folder. But the result will not be different is my guess.
The best way you can manage Import/Export for MySQL is to use a Free Tier WebSite and Install the phpMyAdmin extension.
I am trying to export a mysql schema from remote server to local but geting the following error:
C:\Program Files\MySQL\MySQL Server 5.6\bin>mysqldump --skip-secure-auth -h x.y.z.d -uatulya -p'root' t_tcadmin |mysql -u root -proot t_tcadmin
mysqldump: unknown option '--skip-secure-auth'
Warning: Using a password on the command line interface can be insecure.
Without the --skip-secure-auth it connects but I get error 2049.
So I want to use this option to skip secure auth but it is giving the above error. Could anyone suggest.
Thanks..
If you are in a pinch, dealing with an older server where updating the passwords to the newer method is not an option (say, MySQL Server v5.0.95) and attempting to migrate the data to a newer system - without modifying the fragile older system, you may need to temporarily downgrade your local mysql client to 5.5 for myasqldump to be able to talk to the older server. As of 5.6 it is possible to use the MySQL client to connect to it - using --skip-secure-auth in the command, but mysqldump will not accept that flag. And, in MySQL 5.7+ it is impossible to connect to a server that uses the older password storage method at all.
My Application uses Mysql database and is hosted on linux server, and I am using Zoc terminal from my window system to connect to mysql Db. I am trying to backup mysql database using mysql dump through Zoc terminal, however its says: ERROR 1064 (42000): You have an error in your SQL syntax.
Anyone, who could help me..
Any help would be highly appreciated.
Not familiar with Zoc terminal, however dumping a database is fairly easy through command line.
mysqldump -u user -p database > database.sql
There is also the --all-databases trigger as well.