After changing the collation in phpmyadmin for several databases, I can't see them anymore in chrome and explorer. If a use the command SHOW DATABASES in the command line, they are all displayed.
In Firefox, the following error is thrown:
SET CHARACTER SET 'utf8mb4';
1115 - Unknown character set: 'utf8mb4'
This is my first post, any help would be appreciated.
Edit:
I had already read Q&A in ERROR 1115 (42000): Unknown character set: 'utf8mb4', but it didn't solve my problem.
The mysql version I'm using is 5.6.17, and the character set is supported from version 5.3.3, so updating wouldn't help. I'm using wamp 2.5 with Mysql 5.6.17, Apache 2.4.9 and PHP 5.5.12.
And I get the error simply accessing http://localhost/phpmyadmin (not executing any sql) after my update, so the problem seems to be already commited. It's quite confusing that the error message is displayed only in Firefox while other browsers simply hide some databases and show the others.
Executing 'SELECT default_collation_name FROM information_schema.SCHEMATA;' in command line brought me these results:
utf8_general_ci
utf8_general_ci
utf8_spanish_ci
utf8_general_ci
utf8_general_ci
utf8_spanish_ci
utf8_general_ci
utf8_spanish_ci
utf8_general_ci
latin1_swedish_ci
utf8_spanish_ci
utf8_general_ci
utf8_general_ci
utf8_general_ci
utf8_general_ci
latin1_swedish_ci
utf8_general_ci
utf8_general_ci
utf8_general_ci
utf8_general_ci
utf8_general_ci
utf8_general_ci
In PhpMyAdmin, the SCHEMATA table only shows ¡three! results:
One for 'information_schema', another for 'mysql' and the last one for one of my databases. The others are not there.
After some research, I discovered there where two instances of mysql running on my server.
Phpmyadmin was using a 32 bits old version while the mysql command line was linked to the 64 bits one. I stopped the old one and now everything runs ok.
Related
I have a mysql database in Gcloud using utf8 enconding and I want to change it to utf8mb4 to support storing emoticons.
I did this using my local version of mysql in my laptop and it worked fine using:
ALTER TABLE table_name CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER DATABASE db_name CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
But when I try to do the same in Gcloud, the commands are accepted and the encoding changes but I keep receiving this error when trying to insert the record:
"error": "could not execute statement; nested exception is org.hibernate.exception.GenericJDBCException: could not execute statement: Incorrect string value: '\xF0\x9F\xA6\x95' for column 'text' at row 1" }
I also changed character_set_server variable in gcloud to utf8mb4 and restarted the engine but it does not work. Does anybody know what else should I change?
Thanks!
I'm migrating a small Gyroscope app from MySQL to MariaDB. I asked this question earlier on why MariaDB would not start on latin1 as server encoding (MariaDB won't start when character-set-server = latin1 is in my.cnf), but now I've come to terms with using just utf8.
After importing the data dump:
mysql -uwebuser -p ezine < dump.sql
, what's supposed to be autotööstus shows up as autot??stus. In addition I got this error:
illegal mix of collations (latin1_general_ci implicit) and (utf8_general_ci coercible), storing ??
Attempt 1: I removed all the occurrences of charset=latin1 in the data dump, and the import terminated early with this error:
Specified key was too long; max key length is 767 bytes
Attempt 2: added back charset, but set it to charset=utf8, according to this post: MySQL Convert latin1 data to UTF8
The import works, but autotööstus is now showing as autotööstus
How do I interpret the data dump as latin1 encoded content but deposit into a utf8 storage?
If you cannot use latin1 as the default system encoding for whatever reason, here's a quick solution:
Leave the data dump as-is. Even though it's latin1 encoded, it can be imported as utf8.
mysql> create database ezine character set utf8 collate utf8_general_ci;
mysql -uwebuser -p --default-character-set=utf8 ezine < dump.sql
Now in your web app, you should correctly see autotööstus
From now on, the "native currency" of your database is utf8. When dumping the database, you have to be careful, make sure the exported file is still latin1 encoded.
Otherwise you'll end up with the over-encoded data, such as autotööstus.
mysqldump -uwebuser -p --default-char-set=latin1 ezine > dump.sql
Getting the above error message when I run a php script in windows using the command prompt. I am using mySQL version 6.3. Character and collation settings for mySQL are as follows:
Character and collation settings image
As you can see from the above image, all settings apart from the collation_connection are unicode_ci, and character sets are utf8mb4 other than system. Other steps I have already taken:
Checked and double checked that all my columns with the name 'name' in my table are using the right character set and collation - utf8mb4 and utf8mb4_unicode_ci respectively; all are fine.
Added the following lines in my my.ini file under the mysql section:
default-character-set=utf8mb4
and the following lines under mysqld:
character-set-server=utf8mb4
collation-server=utf8mb4_unicode_ci
init_connect='SET NAMES utf8mb4 COLLATE utf8mb4_unicode_ci'
Also made sure that the configuration file in Workbench is the same one I have been editing.
SQL mode is set to:
sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
Have obviously restarted :P
Can anyone think what else it could be? Been stuck on this for a while now :(
How can I change connection collation of mysql database?
I am using Mysql workbench 5.5 and mysql 5.5 in ubuntu 14.
When I execute a stored procedure, an error occurs:
Error Code: 1267. Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT) for operation '='
I have search though the internet, which has a temp solution that is to amend
COLLATE utf8_unicode_ci;
in the stored procedure.
But I want to fix this problem for all stored procedures in the future. I have found
SHOW VARIABLES LIKE 'collation%';
which return this.
collation_connection utf8_general_ci
collation_database utf8_unicode_ci
collation_server latin1_swedish_ci
how can I change utf8_general_ci to utf8_unicode_ci?
Look into your my.cnf, find the contents below near collation_server:
[mysqld]
init_connect='SET collation_connection = utf8_unicode_ci'
init_connect='SET NAMES utf8'
character-set-server=utf8
collation-server=utf8_unicode_ci
skip-character-set-client-handshake
Then change your collation variables to:
collation_connection utf8_unicode_ci
collation_server latin1_swedish_ci
Remember to restart MySQL server service.
For DB collation, you can use the following SQL:
ALTER DATABASE <database_name> CHARACTER SET utf8 COLLATE utf8_unicode_ci;
or you can do it at Alter database screen in MySQL Workbench (always update this to the latest version!)
Firstly, I think the error message is because of the collation of stored procedure (connection) doesn't match the table. But I was wrong, the reason for the error is because of the collation of the column doesn't match the collation of the table.
I want to change to collation of column to 'utf8_unicode_ci' in my case. So
I have run this statement:
alter table <YourTableName>
MODIFY <YourColumnName> VARCHAR(XXX) COLLATE 'utf8_unicode_ci';
Please be aware that change of collation may result in data loss. For me, General -> Unicode, with all English in varchar column. There is none.
Further reading:
http://dev.mysql.com/doc/refman/5.7/en/charset-column.html
http://dev.mysql.com/doc/refman/5.7/en/charset-connection.html
http://dev.mysql.com/doc/refman/5.7/en/charset-database.html
I have PHP 5.5.9 and MySQL 5.5.43 Innodb. This is in Kubuntu LTS /etc/mysql/my.cnf
printf("Current character set: %s\n", mysqli_character_set_name($conn));
Current character set: latin1
I've tried
default-character-set = utf8
first but then my mysql server didn't restart
Then I've tried
character-set-server = utf8
then my mysql shell didn't start
How can I rescue this issue? I've managed with
init_connect = 'SET NAMES utf8'
solve the problem for nonroot users, but the charset remains the same (it only displays as nonprivileged users UTF8, it is still Latin1).
And if (a big if) smnd could tell me WHERE should I use utf8mb4? Also in my.cnf file? I had my tables in utf8 and have migrated those with which I am working to utf8mb4 ...
Another Q: IS that applicable for Linux (Kubuntu) server:
https://www.youtube.com/watch?v=3M1Wpw4uOoM
Please help me, thanks, Gregor from lilaum.com
mysqli_set_charset('utf8').
init_connect is ignored for root connections.
utf8mb4 is effectively a superset of utf8. It is needed for Chinese and the new emoji, plus a scattering of obscure character sets.
PHP manual says:
MySQLnd always assumes the server default charset. This charset is sent during connection hand-shake/authentication, which mysqlnd will use.
MySQLnd is the MySQL native driver included with PHP 5.4 and above.
Unfortunately, I have to confirm that even in my system (PHP 5.6.17 with MySQL 5.5.47 on Debian Jessie 8.3) despite having configured /etc/mysql/my.cnf with the following entries
[mysqld]
character-set-server=utf8
[mysql]
default-character-set=utf8
the mysqlnd does not seem to assume the server default charset (utf8) but sets the connection charset to latin1 with collate latin1_swedish (maybe a default value considering MySQL AB was a swedish company).
So, it seems that there's no permanent way to set utf8 charset when connecting from a PHP application. You have to call
$mysqli->set_charset("utf8")
after each connection. This could be embedded in a custom 'dbconnect' PHP function in order to provide a sort of abstraction layer.