我有一个现有的 sql 文件,我想将其导入 MySQL 数据库 5.5 导入后我执行:SELECT * FROM address; 而不是 'Straße' 我得到 'Straße' 导入命令是: mysql -uroot store < C:\PathTo\store.sql 使用 phpMyAdmin 我得到相同的结果。有趣的是,这在一年前就有效(也许与另一个 MySQL DB 版本一起使用)
DROP SCHEMA IF EXISTS store;
CREATE SCHEMA IF NOT EXISTS store DEFAULT CHARACTER SET=latin1;
USE store;
SET sql_mode = 'STRICT_ALL_TABLES';
SET NAMES latin1;
...
DROP TABLE IF EXISTS address;
CREATE TABLE IF NOT EXISTS address (
pk_id INT UNSIGNED NOT NULL AUTO_INCREMENT,
zipCode DECIMAL(6,0) NOT NULL,
city VARCHAR(32) NOT NULL,
street VARCHAR(32) NOT NULL,
number VARCHAR(8) NOT NULL,
fk_customer INT UNSIGNED NOT NULL,
PRIMARY KEY (pk_id),
CONSTRAINT
FOREIGN KEY (fk_customer)
REFERENCES customer(pk_id)
ON DELETE CASCADE
ON UPDATE CASCADE
);
...
insert into address (zipCode, city, street, number, fk_customer) values(111, "MyCity", "Straße", "7", 1);
...