There is MySQL database with one table:
<?php
$con=mysqli_connect("db2.ho.ua","spectorsky","s124816",spectorsky);
if (!$con) echo mysqli_connect_errno() . PHP_EOL.mysqli_connect_error() . PHP_EOL;
$sql="CREATE DATABASE if not exists spectorsky CHARACTER SET = utf8 COLLATE = utf8_unicode_ci";
$mysql_result=mysqli_query($con,$sql);
if ($mysql_result) {
echo "Database spectorsky created successfully". PHP_EOL; } else
echo "Database spectorsky hasn't been created: ".$con->errno.$con->error. PHP_EOL;
$sql="Create table if not exists categories (idCategory INTEGER PRIMARY KEY, nameCategory TEXT)". " CHARACTER SET = utf8 COLLATE = utf8_unicode_ci";
if (mysqli_query($con,$sql)){
echo "Table categories created successfully". PHP_EOL; } else
echo "Table categories hasn't been created: ".mysqli_error($con). PHP_EOL;
mysqli_query($con,"delete from categories") or die(mysqli_error($con));
echo "That's all";
mysqli_close($con);
?>
Text field of the table contains Cyrillic data in unicode charset. The table is created on Adroid device, then exported to and the imported from the server. After that, all strings on Android device are correct. However, when I try to see these strings on the server via phpmyadmin, they are displayed in cp1251 (string АБВ is displayed as АБВ). In the list of phpmyadmin variable list I see that the variable character set database
is set to 1251, I I have no sufficient rules to edit it. Queries set names utf8
or set character_set_database to utf8
at SQL tab are performed with no error, but nothing changes.
So, the question: is it possible to change character_set_database
variable for the current session, or maybe there is other way to make phpmyadmin to display unicode in a correct way?
Thanks in advance