mysql console > mysqlbinlog You have an error in your SQL syntax - mysql

I have WAMP installed that has been binary logging all changes in my database. I found the logs, the mysql console also shows them when I perform a SHOW BINARY LOGS. But when I try to read them by executing:
mysqlbinlog mysql-bin.000197
it gives me that error:
ERROR 1016(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 'mysqlbinlog mysql-bin.000197' at line 1
MySQL version is 5.5.20

have you used shell command ?
shell> mysqlbinlog mysql-bin.000197

Related

Error when switching user in mysql client

When trying to switch to another user from root I am getting the below error. But most of the examples show this is right syntax. Could you please help me?
Error:
You have an error in SQL syntax; check the manual that corresponds to your mysql version for the right syntax to use near 'mysql -u bcs_fms -p'
You have to execute this command from CLI, not from the mysql console.

syntax error with mysqldbcompare command

mysql -V is 5.5.54 for debian (Jessie).
I'm at the mysql command prompt trying to run this command:
mysqldbcompare --server1=root#localhost calendar_dup:calendar --run-all-tests
I get the following error:
ERROR 1064 (42000): You have an error in your SQL sytax; check manual that corresponds to your MySQL server version for the right syntx to use near 'mysqldbcompare --server1=root#127.0.0.1 calendar_dup:calendar --run-all-tests' at line 1
Needed to install via apt-get: https://packages.debian.org/jessie/mysql-utilities
Also, should be run from shell command line, not mysql command line.

Backwards compatible mysql dump

I am trying to port a database from mysql 5.7 to mysql 5.5.
At first, I used the following command
mysqldump -u root -p --all-databases > alldbs.sql
When I try to import the DB in mysql 5.5 I keep getting errors like
ERROR 1064 (42000) at line 572: 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 'STATS_PERSISTENT=0' at line 9
where it complains about STATS_PERSISTENT=0 statement.
Then I tried
mysqldump -u root -p --compatible=mysql40 --all-databases > alldbs.sql
but this just gives me
ERROR 1064 (42000) at line 26: 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 'TYPE=InnoDB' at line 22
where it complains about TYPE=InnoDB statement, which should be ENGINGE=InnoDB. Even with the --compatible option it still keeps the STATS_PERSISTENT statement.
Is there a way to port a mysql 5.7 database to mysql 5.5?
UPDATE
To be clear on my question, I am looking for relialble, i.e. no-hack way, to port the database. I already tried to replace TYPE with ENGINE, remove STATS_PERSISTENT etc. Something else always came up. I am not willing to jump through those hoops everytime I port the database. I am looking for a reliable way via mysqldump or a similiar tool to do the job.
If this is not possible then I will have to switch to an alternative DB.

Getting SQL syntax error while importing table into database using Mysql

I am getting the following error while trying to import the table into database using MySQL on my Ubuntu machine.
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 -u root -p spesh db_hit_type < /var/www/html/spesh.com/public_html/portal/' at line 1
I was using the following command to import the table data.
mysql -u root -p spesh db_hit_type < /var/www/html/spesh.com/public_html/portal/js/db_hit_type.sql;
I think that you try to run this command in MySQL command promt or in some client program. You need to run mysql program from server console, not from mysql console.

Setting up timezones in mysql

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'