MySQL:问号而不是符号

时间:2018-07-12 21:23:38

标签: mysql sql encoding utf-8

我已经在MariaDB中创建了一个数据库,然后运行了一些SQL创建表 像这样:

    create table customers
    ( customerid int unsigned not null auto_increment primary key,
      name char(50) not null,
      address char(100) not null,
      city char(30) not null
    );

    create table orders
    ( orderid int unsigned not null auto_increment primary key,
      customerid int unsigned not null,
      amount float(6,2),
      date date not null
    );

然后我尝试用一​​些数据填充它:

insert into customers values
  (3, "Саша Валентей", "12, ул. Гудвина", "г. Изумрудный"),
  (4, "Ева Легкая", "34, пр. Незнайки", "г. Солнечный"),
  (5, "Слава Моргунов", "56, пер. Поттера", "пгт Хогвартс");

insert into orders values
  (NULL, 3, 69.98, "2008-04-02"),
  (NULL, 1, 49.99, "2008-04-15"),
  (NULL, 2, 74.98, "2008-04-19"),
  (NULL, 3, 24.99, "2008-05-01");

这很西里尔字母。现在我有问号 字符应该是。我的服务器是UTF-8,而表似乎是latin_swedish_ci。我该如何解决这个麻烦?

1 个答案:

答案 0 :(得分:0)

尝试一下:

ALTER TABLE customers CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;