Hosting Prestashop, Magento y WordPress listo para usar, optimizado y con mejoras exclusivas. Soporte especializado, servidores en España
There was a problem loading the comments.

Change encoding of MySQL database and tables to UTF-8

Support Portal  »  Knowledge base  »  Viewing Article

  • Access the server through SSH and the root user or a user with MySQL administrative privileges.
  • Run the following line, substituting the "dbname" values for the database itself. This will change the encoding of each table to utf8:

mysql --database=dbname -B -N -e "SHOW TABLES" | awk '{print "SET foreign_key_checks = 0; ALTER TABLE", $1, "CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci; SET foreign_key_checks = 1;"}'}' | mysql --database=dbname.

  • After that, we access MySQL using:


  • Once inside, to change the database encoding, we execute the following, changing "dbname" for the database in question:

ALTER DATABASE dbname CHARACTER SET utf8 COLLATE utf8_general_ci;

Si todavía tienes dudas, contacta con nosotros y te ayudamos.

Share via
Did you find this article useful?  

Related Articles


Add Comment

Replying to  

Order By: 
Me funciono directamente con ALTER DATABASE dbname CHARACTER SET utf8 COLLATE utf8_general_ci; dentro de mi base de datos para poder cambiarlo
  2 · Reply

Self-Hosted Help Desk Software by SupportPal