MySQL错误1064语法,但一切似乎都很好 [英] MySQL error 1064 syntax but everything seems fine

查看:466
本文介绍了MySQL错误1064语法,但一切似乎都很好的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用xampp控制面板,然后从那里开始apache和mysql的过程.然后我转到mysql工作台,服务器状态似乎还可以,这是一些信息

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;

我收到以下错误

 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将开始在mariaDb上使用mysql语法?

So what can i do so that xampp will start using mysql syntax over mariaDb?

或者如果我对问题的理解不正确,那该怎么办,这样在使用xampp时不必再次面对此类问题?

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?

推荐答案

问题是单词VISIBLE,将其删除即可. 默认情况下,索引可见.

Problem is the word VISIBLE, remove it and it will work. Index are visible by default.

您的问题:如果我删除VISIBLE,它就可以正常工作,那么mysql workbench为什么决定添加可见的?"

Your question: "If i remove VISIBLE it works just fine, so why did mysql workbench decided to add visible?"

我的答案:标记索引不可见的选项尚未在MariaDB中实现(afaik!).

My answer: The option to mark index invisible is not yet implemented in MariaDB (afaik!).

更新:

MariaDB的语法不同,请参见以下参考: https://jira.mariadb. org/browse/MDEV-7317

The syntax for MariaDB is different, please see this reference: https://jira.mariadb.org/browse/MDEV-7317

这篇关于MySQL错误1064语法,但一切似乎都很好的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆