mariadb console does not accept mutated vowel (umlaute) when using 'source Table.sql'

时间:2018-06-04 17:44:43

标签: mysql sql-server mariadb

I recently set up a new Raspi 3 with Raspbian Stretch Lite. (LAMP)

Now I would like to move a database from Raspi 2 to the new Raspi 3, using the create files I have on the Raspi 2. On Raspi 3 MariaDB is set up, on Raspi 2 MySQL.

To create the DB I use the mantioned sql files from the Raspi 2.
(like 'source 00_CreateDB.sql', 'source 10_...sql')
On the Raspi 2 all worked fine, on the Raspi 3 all mutated vowels are ignored or replaced with '?', when I install the tables by using sql files. (like 'source 10_CreateDB.sql')

When I copy&paste the table code from the sql file, all creation and insert works fine.

Also when displaying db content on a browser with php scrips, all works fine.
(SELECT, UPDATE, ...)

Any idea for that behaviour ?
I mean that the copy and pasted code works, but when 'source CreateTableA.sql' is used, mutataed vowels are wrong ?

I already tried several ways to execute my files with mysql but all failed.
Like 'mysql -u root -p < 10_CreateDB.sql' ...


Here the code I used, copied from the files.

DROP DATABASE IF EXISTS `pool`;
CREATE DATABASE `pool` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;

CREATE TABLE IF NOT EXISTS `TempSensorName` (
  `DeviceID`                char(16)     NOT NULL,
  `DisplayNumber`           tinyint      unsigned NOT NULL auto_increment, #-- Displayed in order of these number
  `Name`                    varchar(100) default "",
  `Comment`                 varchar(256) default "",

  `Override`                tinyint      unsigned NOT NULL default 0, #-- Override 0:NO, 1:On (to OverrideVal)
  `OverrideVal`             DECIMAL(6,3) default 0,                   #-- Override Value
  `DisplayLive`             tinyint      unsigned NOT NULL default 0, #-- DisplayLive status on browser top window 0:No, 1:Yes
  `DisplayMain`             tinyint      unsigned NOT NULL default 0, #-- DisplayMain status on browser main window 0:No, 1:Yes
  `DisplayMainColor`        varchar(30),                              #-- DisplayMainColor on browser main window
  `Customer`                tinyint      unsigned NOT NULL,           #-- Customer who changed the value
  `LastUpdateDateTime`      timestamp             NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
  PRIMARY KEY  (`DeviceID`),
  UNIQUE  KEY  `ukDisplayNumber` (`DisplayNumber`)
) ENGINE=InnoDB AUTO_INCREMENT=10;

INSERT INTO `TempSensorName` (`DeviceID`,        `Name`,     `Comment`,        `Override`, `OverrideVal`, `DisplayLive`, `DisplayMain`, `DisplayMainColor`, `Customer`) VALUES
                             ('CPU',             'CPU',      'CPU Temperatur', 0,           NULL,         1,             0,             0,                  100),
                             ('28-03160644beff', 'Zulauf',   'erster Sensor',  0,           NULL,         0,             1,             '#FF0000',          100),
                             ('28-03160644e7ff', 'Rücklauf', 'zweiter Sensor', 0,           '3.7',        0,             1,             '#00FF00',          100),
                             ('28-0416021c67ff', 'Pumpen',   'dritter Sensor', 0,           0,            0,             0,             '#0000FF',          100);
SELECT * FROM TempSensorName ORDER BY DisplayNumber;




Here all I checked that its set correct on the Raspi 3:

Only UTF_8 is installed. Locale is set to UTF_8:

LANG=de_DE.UTF-8
LANGUAGE=
LC_CTYPE="de_DE.UTF-8"
LC_NUMERIC="de_DE.UTF-8"
LC_TIME="de_DE.UTF-8"
LC_COLLATE="de_DE.UTF-8"
LC_MONETARY="de_DE.UTF-8"
LC_MESSAGES="de_DE.UTF-8"
LC_PAPER="de_DE.UTF-8"
LC_NAME="de_DE.UTF-8"
LC_ADDRESS="de_DE.UTF-8"
LC_TELEPHONE="de_DE.UTF-8"
LC_MEASUREMENT="de_DE.UTF-8"
LC_IDENTIFICATION="de_DE.UTF-8"
LC_ALL=

MariaDB all is set to utf8 and on db creation default is set to utf8:

SELECT * FROM INFORMATION_SCHEMA.SCHEMATA;
+--------------+--------------------+----------------------------+------------------------+----------+
| CATALOG_NAME | SCHEMA_NAME        | DEFAULT_CHARACTER_SET_NAME | DEFAULT_COLLATION_NAME | SQL_PATH |
+--------------+--------------------+----------------------------+------------------------+----------+
| def          | information_schema | utf8                       | utf8_general_ci        | NULL     |
| def          | mysql              | utf8mb4                    | utf8mb4_general_ci     | NULL     |
| def          | performance_schema | utf8                       | utf8_general_ci        | NULL     |
| def          | phpmyadmin         | utf8mb4                    | utf8mb4_general_ci     | NULL     |
| def          | pool               | utf8mb4                    | utf8mb4_general_ci     | NULL     |
+--------------+--------------------+----------------------------+------------------------+----------+

show variables like 'char%'; show variables like 'collation%';
+--------------------------+----------------------------+
| Variable_name            | Value                      |
+--------------------------+----------------------------+
| character_set_client     | utf8mb4                    |
| character_set_connection | utf8mb4                    |
| character_set_database   | utf8mb4                    |
| character_set_filesystem | binary                     |
| character_set_results    | utf8mb4                    |
| character_set_server     | utf8mb4                    |
| character_set_system     | utf8                       |
| character_sets_dir       | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec)


+----------------------+--------------------+
| Variable_name        | Value              |
+----------------------+--------------------+
| collation_connection | utf8mb4_general_ci |
| collation_database   | utf8mb4_general_ci |
| collation_server     | utf8mb4_general_ci |
+----------------------+--------------------+

0 个答案:

没有答案