0

I'm using PHP 5.6.40 and MySQL 5.7 but when I want to connect remote database(MySQL 8), occur a problem.

Warning: mysql_connect(): Server sent charset (255) unknown to the client.

Although I tried a lot of things like here but nothing has changed.

My Connection Code

$connect = mysql_connect("XXX:25060","XXX","XXX") or die ();
mysql_select_db("defaultdb", $connect) or die ( mysql_error() );
Robert
  • 7,394
  • 40
  • 45
  • 64
Gophier
  • 21
  • 5
  • I hope you use PDO or myqli extensions instead of mysql because it is deprecated in later version of PHP. Despite i really eager to see your connection code, so please edit your question by posting it. – Hardood May 23 '20 at 01:11
  • I am not supposed to make any changes, I have to use mysql. I know mysql is deprecated but my server environment still work with mysql – Gophier May 23 '20 at 01:15
  • Does this answer your question? ["Server sent charset (255) unknown to the client" Set MySQL charset to utf8 w/o /etc/my.cnf?](https://stackoverflow.com/questions/51051440/server-sent-charset-255-unknown-to-the-client-set-mysql-charset-to-utf8-w-o) – Jsowa May 25 '20 at 07:51
  • Does it work for you? – Jsowa May 27 '20 at 02:42

1 Answers1

0

MySQL uses different character set (utf8mb4), so you must change configuration of MySQL.

[mysqld]
collation-server = utf8_unicode_ci
character-set-server = utf8

I hope you know that you should not use mysql_ functions.

Jsowa
  • 9,104
  • 5
  • 56
  • 60