MYSQL Import Failing because of `//` - wordpress

I have a mysql file that seems to be breaking at some HTML/JS that is stored in the database.
Here are a few errors:
[ERROR in query 178] 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 '
and
[ERROR in query 179] 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 '}
// ]]>
</script>
<script src="./js/tooltip.js" type=' at line 1 [ERROR in query 180]
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 '}
/* ]]> */
and
[ERROR in query 181] 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 'Table
'./web_cms_prod/wp_redirection_logs'
is marked as crashed and should be re'
at line 1
Its a wordpress database if that matters, not sure why someone is storing HTML in the database, but I need to get it imported nonetheless.
Any ideas? Can I escape it somehow? A SED unix command would be nice as its a 9 meg file.

It's probably not the // but some quotes that appear before it. You need to make sure that all of the quotes contained within your string values are escaped.

Related

Flyway 7.7.3 seems to ignore my "callback"

I am upgrading from Flyway 5.4 to 7.7.3 and ran into some issue.
flyway -teams -url=jdbc:oracle:thin:#localhost:1521/XE "-user=xxx as SYSDBA" -password=xxx -table=flyway_schema_history_app -encoding=utf-8 -baselineOnMigrate=true migrate
(I have the teams edition license)
Flyway gives me the following error message:
**
ERROR: Unable to parse statement in /flyway/sql/incremental/Build_302_Baseline/V302_106__fosprd_INSERT_Master_eg_pocqueue.sql at line 117 col 1. See https://flywaydb.org/documentation/knownparserlimitations for more information: No value provided for variable substitution: &R. Check your configuration. If this is not a SQLPLus variable intended to be substituted (eg. in a string literal), then you will need to add SET DEFINE OFF in the script beforehand.
Caused by: No value provided for variable substitution: &R. Check your configuration. If this is not a SQLPLus variable intended to be substituted (eg. in a string literal), then you will need to add SET DEFINE OFF in the script beforehand.
**
This is caused by a special character "&" in the SQL statement, however, I have made sure the SQL file is using UTF-8 encoding as well as Unix return (LF).
Also, I keep my callbacks under:
bash-5.0$ pwd
/flyway/sql/callbacks
bash-5.0$ ls
afterBaseline.sql afterEachUndo.sql afterMigrateError.sql afterUndo.sql beforeEachUndo.sql
afterBaselineError.sql afterEachUndoError.sql afterRepair.sql afterUndoError.sql beforeMigrate.sql
afterEachMigrate.sql afterMigrate.sql afterRepairError.sql beforeEachMigrate.sql beforeUndo.sql
This used to be able to run on 5.4 with no issue. But it's giving me this error on 7.7.3, anyone can point me to the right direction?
Thanks
This is due to the changes between versions of flyway's SQLPlus support and the fat you have a teams license.
As indicated in the message, this is related to SQLPlus's variable substitution:
https://flywaydb.org/documentation/database/oracle#variable-substitution
If you are not using SQLPlus features, you could try disabling them:
https://flywaydb.org/documentation/configuration/parameters/oracleSqlPlus
but the recommended solution is to place SET DEFINE OFF in the SQL script before the offending ampersand (with the option of reverting that afterwards)

MySQL Workbench cannot forward engineer, error 1064 [duplicate]

Im using xampp control panel and from there i start the process for apache and mysql. Then i go to mysql workbench and server status seems to be ok, here is some info
Host: Windows-PC
Socket: C:/xampp/mysql/mysql.sock
Port: 3306
Version 10.1.31-MariaDB mariadb.org binary distribution
Compiled For: Win32(32)
Configuratin File: unknown
Then everytime when i try to add the foreign key for my dummy schema like:
ALTER TABLE `puppies`.`animals`
ADD INDEX `Breed_idx` (`BreedID` ASC) VISIBLE;
;
ALTER TABLE `puppies`.`animals`
ADD CONSTRAINT `Breed`
FOREIGN KEY (`BreedID`)
REFERENCES `puppies`.`breeds` (`Breed`)
ON DELETE NO ACTION
ON UPDATE NO ACTION;
I get the following error
ERROR 1064: You have an error in your SQL syntax; check the manual that
corresponds to your MariaDB server version for the right syntax to use near
'' at line 2
SQL Statement:
ALTER TABLE `puppies`.`animals`
ADD INDEX `Breed_idx` (`BreedID` ASC) VISIBLE
So what can i do so that xampp will start using mysql syntax over mariaDb?
Or if im wrong in my understanding of the problem, then what should i do so that i dont have to face this kind of issues again when using xampp?
Problem is the word VISIBLE, remove it and it will work.
Index are visible by default.
Your question: "If i remove VISIBLE it works just fine, so why did mysql workbench decided to add visible?"
My answer: The option to mark index invisible is not yet implemented in MariaDB (afaik!).
Update:
The syntax for MariaDB is different, please see this reference: https://jira.mariadb.org/browse/MDEV-7317
Just to add to those who are using Maria DB with MySQL Workbench, you don't need to install mysql. You can just change 'Default Target MySQL Version' from Preferences to 5.7 or 5.6, and the VISIBLE keyword will be removed by workbench.
Here is a link from mysql bugs
https://bugs.mysql.com/bug.php?id=92269
I am using MySQL Workbench and have same problem. Change in the Preferences but it did not work.
Solution: If you export forward-engineer the model you need to change the configuration on another place.
Go to Model > Model Options
Inside the Model Options, go to MySQL
Then change the "Target MySQL Version" to 5.6

Mariadb syntax error in multipleStatements

When i am trying to execute the multipleStatements in Mariadb like this
db.Connection.query("CALL tep_procedure_out(?,#out_value);Select #out_value",["rahul"],
I set {multipleStatements: true} in my connection even though i am getting Error.
{ Error: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'Select #out_value' at line 1 code: 1064 }
By default sending multiple statements is disabled (not only in node.js but in most other connectors) for security reasons.
If you want to use multiple statements you have to specify it when establishing the connection:
var conn = mysql.createConnection({multipleStatements: true});

Importing database to 000webhost and receiving the following error: #1064

Error: - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '#', 1) LIMIT 1' at line 2
Thanks in advance.
I had the same problem.When you are importing whole DB then its quite difficult to find the error.
Check Your 'Option' Column. Problem Could Be In Dumping The Data There.
But I solved it in my way, I didn't import whole DB, I uploaded in pieces.Now what you have to do is
-Import Each Column Manually.
-Then Dump It Manually
There You Go.

Liquibase/SQLite syntax error

So I have a sqlite database. My game (C#) is able to open it and run it quite nicely. However, for maintainability and potential conflict reasons, I would like a more manageable format. Our project manager suggested Liquibase. I'm not sure if it's just out of date or what, but it will NOT convert for me, and I'm not sure why. Here's what we got:
running on windows 8.1
liquibase version 3.3.0 (http://www.liquibase.org/download/index.html)
sqlite database made using sqlite manager demo version 4.3.5 (http://www.sqlabs.com/sqlitemanager.php)
java version 8 update 25
sqlite-jdbc-3.8.7 (https://bitbucket.org/xerial/sqlite-jdbc)
The command I enter is...
liquibase --classpath=sqlite-jdbc-3.8.7.jar --driver=org.sqlite.JDBC\
--url="jdbc:sqlite:GameData.sqlite" --changeLogFile=gamedb-canges.xml\
--username=username --password=password generateChangeLog
and the error I get is...
Unexpected error running Liquibase: liquibase.exception.DatabaseException:
liquibase.exception.DatabaseException: java.sql.SQLException: [SQLITE_ERROR]
SQL error or missing database (near ")": syntax error)
I'd try removing the quotes around the URL. You can also include --logLevel=debug on the command line to get better diagnostics.
"SQL error or missing database" is an error message that comes from the SQLite db.
Try to add a full path to the sqlite db like:
--url="jdbc:sqlite:C:\myPath\GameData.sqlite"

Resources