Problema con la "Ñ" en MySQL

90 views
Skip to first unread message

Manuel Encarnacion

unread,
Aug 4, 2016, 4:52:35 PM8/4/16
to LinuxCabal
Saludos,

Tengo un servidor con un sistema en PHP 5.4.20 (cli) y MySQL con 5.5.25a en opensuse funcionando correctamente. Estoy migrando ese servidor a otro server en centOS 7 con PHP 5.4.16 (cli) y MySQL Distrib 5.6.31. 

El problema es que al conectar el server de CentOS a la DB del opensuse funciona bien por el contrario cuando conecto el server de centos a el mismo (localhost, ip) se conecta pero me trae los datos con caracteres especiales como la " ñ " con un simbolo " ? ". 

Estoy consiente que es la DB del CentOS (MySQL Distrib 5.6.31.) que tiene el problema porque cuando pongo el sistema que estan en OpenSuse conectado a Centos me da el mismo error.


Espero haberme dado ha entender, Gracias de Ante mano....






Belmont

unread,
Aug 4, 2016, 5:04:58 PM8/4/16
to linux...@googlegroups.com
Hola buen día:

Si no me equivoco, más que problema de MYSQL checa el "collation"
de tu base de datos/tablas, debe ser utf8_general por ejemplo, es
probable que tengas que volver a cargar tus respaldos de base de datos
poniendo como default el "collation"

Espero sea de utilidad, saludos cordiales.

El 04/08/16 a las 15:52, Manuel Encarnacion escribió:
> MySQL Distrib 5.6.31

Richard Couture

unread,
Aug 4, 2016, 5:31:54 PM8/4/16
to linux...@googlegroups.com
Verificas que cada uno de tus tablas están en default char set y
collation Lo que tuviste en el original, utf8 o latin1, con el comando

MySQL > show create table NombreDeLaTabla;

También verifica que el default charset y el collation server en tu
/etc/my.cnf son correctos.



Richard
> <https://lh3.googleusercontent.com/--9CnBxvka6A/V6OquPbA_-I/AAAAAAAANRE/ooeAFXY-0nETIB9Wj5I0WriVV-PX2IbKACLcB/s1600/CENT.png>
>
> <https://lh3.googleusercontent.com/-ARykqu8cIBo/V6Oqiw2HecI/AAAAAAAANRA/vegBx8PMz6s0AVwzd-MUCgBOPsgj-nNNwCLcB/s1600/OPEN.png>
>

--
LinuxCabal Asociación Civil
Ing. Richard Couture
Novell CNE, ECNE, MCNE
HP/Compaq ASE
Tel.: (+52) (333) 145-2638
Cel.: (+52) (044) 333 377-7505
Web: http://www.LinuxCabal.org
E-Mail: r...@linuxcabal.org
Hosted en la nube Cloud Sigma - www.CloudSigma.com

AVISO DE CONFIDENCIALIDAD: Este correo electrónico, incluyendo en su
caso, los archivos adjuntos al mismo, pueden contener información de
carácter confidencial y/o privilegiada, y se envían a la atención única
y exclusivamente de la persona y/o entidad a quien va dirigido. La
copia, revisión, uso, revelación y/o distribución de dicha información
confidencial sin la autorización por escrito de LinuxCabal está
prohibida. Si usted no es el destinatario a quien se dirige el presente
correo, favor de contactar al remitente respondiendo al presente correo
y eliminar el correo original incluyendo sus archivos, así como
cualesquiera copia del mismo. Mediante la recepción del presente correo
usted reconoce y acepta que en caso de incumplimiento de su parte y/o de
sus representantes a los términos antes mencionados, LinuxCabal tendrá
derecho a los daños y perjuicios que esto le cause.

Manuel Encarnacion

unread,
Aug 4, 2016, 5:40:58 PM8/4/16
to LinuxCabal
Gracias,

Actualice a utf8_general_ci, cargue mi backup, reinicie el servicio MySQL y aun sigue saliendo con caracter especial.

Aqui le comparto mi /etc/my.cnf

###############################################################################################################

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock

# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

lower_case_table_names=1
server-id       = 1

# Recommended in standard MySQL setup
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

#####################################################################################################################################################

Ismael Farfán

unread,
Aug 4, 2016, 6:26:44 PM8/4/16
to linux...@googlegroups.com
Cambiar el juego de caracteres de la consola a mi me ha ayudado con
problemas de esos... inclusive en UI.
LANG=en_US.utf8

Saludos
-Farfán



El 4 de agosto de 2016, 16:40, Manuel Encarnacion
<damu...@gmail.com> escribió:
> --
> Has recibido este mensaje porque estás suscrito al grupo "LinuxCabal" de
> Grupos de Google.
> Para anular la suscripción a este grupo y dejar de recibir sus mensajes,
> envía un correo electrónico a linuxcabal+...@googlegroups.com.
> Para publicar en este grupo, envía un correo electrónico a
> linux...@googlegroups.com.
> Para ver esta conversación en el sitio web, visita
> https://groups.google.com/d/msgid/linuxcabal/3eb968ff-c319-4ff6-a3a5-d255a63cfaae%40googlegroups.com.
> Para acceder a más opciones, visita https://groups.google.com/d/optout.



--
Do not let me induce you to satisfy my curiosity, from an expectation,
that I shall gratify yours. What I may judge proper to conceal, does
not concern myself alone.

Belmont

unread,
Aug 4, 2016, 6:28:46 PM8/4/16
to linux...@googlegroups.com

Pon esta configuración en tu my.cnf

[client]
default-character-set=utf8

[mysql]
default-character-set=utf8


[mysqld]
collation-server = utf8_unicode_ci
init-connect='SET NAMES utf8'
character-set-server = utf8


y vuelve a cargar todo :s


Saludos


El 04/08/16 a las 16:40, Manuel Encarnacion escribió:

Manuel Encarnacion

unread,
Aug 4, 2016, 9:23:02 PM8/4/16
to LinuxCabal
Perfecto Antoine Belmont, 

Con esta configuracion me esta funcionando bien....

Gracias!!!!

Richard Couture

unread,
Aug 5, 2016, 7:14:53 AM8/5/16
to linux...@googlegroups.com

Tu my.cnf es MUY breve. Mira mio

# A generic my.cnf file based on /usr/share/mysql/my-medium.cnf
#
# This is for a system with little memory (32M - 64M) where MySQL plays
# an important part, or systems up to 128M where MySQL is used together with
# other programs (such as a web server)
#

# The following options will be passed to all MySQL clients
[client]
user = root
#password = your_password
port = 3306
socket = /var/lib/mysql/mysql.sock

# Here follows entries for some specific programs

# The MySQL server
[mysqld]
user = mysql
datadir = /var/lib/mysql
port = 3306
socket = /var/lib/mysql/mysql.sock
pid-file = /var/run/mysqld/mysqld.pid
skip-external-locking
key_buffer = 16M
max_allowed_packet = 32M
table_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
default-storage-engine = InnoDB
collation_server = utf8_unicode_ci
character_set_server = utf8

# plugins
plugin_dir=/usr/lib64/mysql/plugin

# http://dev.mysql.com/doc/refman/5.5/en/replication-semisync.html
;rpl_semi_sync_master=semisync_master.so
;rpl_semi_sync_slave=semisync_slave.so

# Others options for Semisynchronous Replication
;rpl_semi_sync_master_enabled=1
;rpl_semi_sync_master_timeout=10
;rpl_semi_sync_slave_enabled=1

# Don't listen on a TCP/IP port at all. This can be a security enhancement,
# if all processes that need to connect to mysqld run on the same host.
# All interaction with mysqld must be made via Unix sockets or named pipes.
# Note that using this option without enabling named pipes on Windows
# (via the "enable-named-pipe" option) will render mysqld useless!
#
#skip-networking

# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

# Replication Master Server (default)
# binary logging is required for replication
#log-bin=mysql-bin

# required unique id between 1 and 2^32 - 1
# defaults to 1 if master-host is not set
# but will not function as a master if omitted
server-id = 1

# Replication Slave (comment out master section to use this)
#
# To configure this host as a replication slave, you can choose between
# two methods :
#
# 1) Use the CHANGE MASTER TO command (fully described in our manual) -
# the syntax is:
#
# CHANGE MASTER TO MASTER_HOST=<host>, MASTER_PORT=<port>,
# MASTER_USER=<user>, MASTER_PASSWORD=<password> ;
#
# where you replace <host>, <user>, <password> by quoted strings and
# <port> by the master's port number (3306 by default).
#
# Example:
#
# CHANGE MASTER TO MASTER_HOST='125.564.12.1', MASTER_PORT=3306,
# MASTER_USER='joe', MASTER_PASSWORD='secret';
#
# OR
#
# 2) Set the variables below. However, in case you choose this method, then
# start replication for the first time (even unsuccessfully, for example
# if you mistyped the password in master-password and the slave fails to
# connect), the slave will create a master.info file, and any later
# change in this file to the variables' values below will be ignored and
# overridden by the content of the master.info file, unless you shutdown
# the slave server, delete master.info and restart the slaver server.
# For that reason, you may want to leave the lines below untouched
# (commented) and instead use CHANGE MASTER TO (see above)
#
# required unique id between 2 and 2^32 - 1
# (and different from the master)
# defaults to 2 if master-host is set
# but will not function as a slave if omitted
#server-id = 2
#
# The replication master for this slave - required
#master-host = <hostname>
#
# The username the slave will use for authentication when connecting
# to the master - required
#master-user = <username>
#
# The password the slave will authenticate with when connecting to
# the master - required
#master-password = <password>
#
# The port the master is listening on.
# optional - defaults to 3306
#master-port = <port>
#
# binary logging - not required for slaves, but recommended
#log-bin=mysql-bin

# Point the following paths to different dedicated disks
tmpdir = /var/tmp
#log-update = /path-to-dedicated-directory/hostname

# Uncomment the following if you are using BDB tables
#bdb_cache_size = 4M
#bdb_max_lock = 10000

# Uncomment the following if you are using InnoDB tables
innodb_data_home_dir = /var/lib/mysql/
innodb_data_file_path = ibdata1:10M:autoextend
innodb_log_group_home_dir = /var/lib/mysql/
innodb_log_arch_dir = /var/lib/mysql/
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
innodb_buffer_pool_size = 16M
# Depricated innodb_additional_mem_pool_size = 2M
# Set .._log_file_size to 25 % of buffer pool size
innodb_log_file_size = 5M
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50
innodb_file_per_table

bind-address=localhost

[mysqldump]
quick
max_allowed_packet = 16M

[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates
default-character-set = utf8

[isamchk]
key_buffer = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M

[myisamchk]
key_buffer = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M

[mysqlhotcopy]
interactive-timeout

[mysql.server]
user=mysql
basedir=/usr

[mysqld_safe]
log-error=/var/log/mysqld/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

Renich Bon Ciric

unread,
Aug 6, 2016, 12:10:14 AM8/6/16
to linux...@googlegroups.com
No se anden comparando los tamaños, or favor! ;D
Reply all
Reply to author
Forward
0 new messages