mysql错误1064语法,但一切似乎都很好
我正在使用XAMPP控制面板,然后从那里开始使用Apache和MySQL的过程。然后我转到MySQL WorkBench,服务器状态似乎还可以,这里有一些信息,
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
然后每次尝试为我的虚拟模式添加外键,例如:
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;
我会收到以下错误,
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
所以我可以做什么,以便XAMPP开始使用XAMPP Mariadb上的MySQL语法?
或者,如果我对问题的理解是错误的,那么我该怎么做,以便在使用XAMPP时不必再次面对这种问题?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
问题是单词
可见
,将其删除并将起作用。默认情况下可见索引。
您的问题:“如果我删除可见的话,它可以正常工作,那么为什么MySQL Workbench决定添加可见的?”
我的答案:在Mariadb(Afaik!)中尚未实现标记索引的选项。
更新:
Mariadb的语法不同,请参阅此参考: https://jira.mariadb.org /浏览/MDEV-7317
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
只是为了添加那些与MySQL Workbench一起使用Maria DB的人,您无需安装MySQL。您可以将“默认目标MySQL版本”从首选项更改为5.7或5.6,并且可见的关键字将由Workbench删除。

这是MySQL错误的链接
https://bugs.mysql.com/bug.com/bug.php?id=92269
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
我正在使用MySQL Workbench,并且有同样的问题。 偏好的变化,但它不起作用。
解决方案:如果您导出向前工程器,则需要在另一个地方更改配置。
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.