mysql - SQL Syntax errors in VS Code in local vs remote host
问题描述
I'm trying to containerize an app so I'm trying to write an init file for a MariaDB database for an existing database that exists on a remote server. I'm using VS Code to connect to the remote server and the .sql file with the contents of the dump has no errors, but when I try and copy it to a different workspace on my local computer, I get many syntax errors.
Examples of the syntax errors:
DROP TABLE IF EXISTS `accounts`;
CREATE TABLE `accounts` (
`table_number` int(11) NOT NULL AUTO_INCREMENT,
`account_id` varchar(12) NOT NULL,
`account_name` varchar(5) NOT NULL,
PRIMARY KEY (`table_number`)
) ENGINE=InnoDB AUTO_INCREMENT=261 DEFAULT CHARSET=latin1;
Incorrect syntax near '`'. Expecting '(', or SELECT.
Incorrect syntax near '11'. Expecting '(', or SELECT.
The error about the ` character is present before "accounts" and before both instances of "table_number" but not before "account_id" and "account_name". Every number in the CREATE has the incorrect syntax warning. I've tried retyping rather than copy and pasting to see if there's hidden characters responsible for these issues, but no luck.
Is this an OS issue? The remote server is a CentOS machine and my local is macOS Catalina. A setting in VS Code I need to specify or change?
解决方案
推荐阅读
- tizen - Edje:如何定义“固定”尺寸组?
- android - 无法通过 Android 模拟器物理键盘更改语言
- python - 在 Windows 上使用 ffmpeg 滚动屏幕截图
- asynchronous - 如何在回调中使用 Rust 期货?
- tensorflow - 如何有效地使用由ordereddict组成的tf.data.Dataset?
- tailwind-css - 如何实现 rgba(0, 0, 0, 0.54) 顺风 css 的文本颜色?
- xamarin.forms - Xamarin.Forms - 为 MasterDetailPage 应用设置一致的背景
- javascript - 如何将序列中的所有元素相乘,但在每次迭代中省略当前元素(javascript)?
- c++ - 创建交换链导致窗口句柄变为无效
- macos - 如何使用 AppleScript 检查菜单项是否已选中