MySQL 错误 1064 语法但一切似乎都很好

MySQL error 1064 syntax but everything seems fine(MySQL 错误 1064 语法但一切似乎都很好)
本文介绍了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 开始使用 mysql 语法而不是 mariaDb?

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 语法但一切似乎都很好的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

ibtmp1是非压缩的innodb临时表的独立表空间,通过innodb_temp_data_file_path参数指定文件的路径,文件名和大小,默认配置为ibtmp1:12M:autoextend,也就是说在文件系统磁盘足够的情况下,这个文件大小是可以无限增长的。 为了避免ibtmp1文件无止境的暴涨导致
What does SQL clause quot;GROUP BY 1quot; mean?(SQL 子句“GROUP BY 1是什么意思?意思是?)
MySQL groupwise MAX() returns unexpected results(MySQL groupwise MAX() 返回意外结果)
MySQL SELECT most frequent by group(MySQL SELECT 按组最频繁)
Why Mysql#39;s Group By and Oracle#39;s Group by behaviours are different(为什么 Mysql 的 Group By 和 Oracle 的 Group by 行为不同)
MySQL GROUP BY DateTime +/- 3 seconds(MySQL GROUP BY DateTime +/- 3 秒)