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.
Related
I have a MySQL database hosted on Digital Ocean Managed Database service. I lost my previous dev machine and did not push the Schema to git along with application files. I am desperate to get back the SQL Schema in my local machine for further Development but have so far been usuccessfull. I have tried so many commands from different suggestions but they all failed.
I connect to the DB via the MySQL Shell using the command:
mysql -u username -password-h example-test-do-user-7878789-0.b.db.ondigitalocean.com -P 25060 -D example_db
All queries are executed successfully via this shell method. When trying to Dump the Schema to my machine, I use the following command:
mysql -u username -p -h mysql-test-do-user-4915853-0.db.ondigitalocean.com -P 25060 your_database_name \> database_file_name.sql
But I get the error as follows: mysqldump: unknown variable 'set-gtid-purged=OFF'
if I remove that part and try again, I get the error:
mysqldump: Got error: 2003: "Can't connect to MySQL server on 'localhost' (10061 "Unknown error")" when trying to connect
which doesnt make sense to me. So, without further ranting; How to I achieve my intended result.
NOTE: I did try Mysql workbench, but it won't connect all together
I can appreciate trying to achieve what you want via mysql shell. I stumbled across the same problem and for quite some tie did not find the help i needed, then I tried doing it using mysql workbench. Try it and you will find that its easier than usin the command-line approach. MySQL Workbench has a good GUI based database miguration capability. You can migrate you Do Managed DB directly into you local mysql server or export a schema dump. If you decide to go wit this approach, just make sure you add your machine's IP as a trusted source, else you will not be able to connect.
I want to export the whole database using workbench. I keep getting the following error message. I used server>data export option in workbench.
This is a known bug in MySQL Workbench 6.3.5. Your options are to either (A) wait for an upcoming Workbench version to fix it, or (B) change your mysqldump binary (under User Preferences) to a different non-bundled mysqldump binary, likely one from MySQL Server 5.6.
You can easily dump the whole database from the command line:
mysqldump -u <db_username> -p -h <db_host> db_name > database_dump.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.
Alright, so I've got a fairly fresh Ubuntu (server) installation. Just finished installing the LAMP server and when I go to create a database I'm getting the generic syntax error (1064 / 42000).
My query:
CREATE DATABASE phpbb;
Pretty simple and pretty standard, so I'm not sure what the issue is. Any ideas?
It looks from your error like you're trying to execute SQL on the command line, something like:
mysql -u mike -p CREATE DATABASE phpbb';
MySQL isn't going to like that, it separates the initiation of the tool from the SQL commands.
What I'd normally do for CREATE DATABASE, as it's a one off, I'd do it manually.
So start the tool with
mysql -u mike -p
This should prompt you for your password, and connect to the local database, giving you a shell prompt:
mysql>
You then issue your
CREATE DATABASE phpbb;
If you want to run scripts from the command line, put them in a file and redirect the input to mysql. Usually you'd redirect the output too - something like this:
mysql -u mike -p < mysqlscript.sql > outputofscript.log
I'm using WAMP Server in a local PC.
I'm trying to export a big database using MySQL console but its just not working. I always get a syntax error 1064
The queries I tried:
mysqldump -u USER -p DATABASE > backup.sql;
mysqldump -u USER -pPASSWORD DATABASE > backup.sql;
(of course I'm replacing USER, PASSWORD and DATABASE with real values)
I also tried some more similar queries but I'm getting the same syntax error every time.
Please help!!!!!
You should type this in your command prompt not in MySQL console.
mysqldump is an application not MySQL command.