时间:2019-09-16 14:31:17 作者:无名 浏览量:28
Linux cron执行mysql失败(编码问题)教程图3
+--------------------------+----------------------------+
/ Variable_name / Value /
+--------------------------+----------------------------+
/ character_set_client / latin1 /
/ character_set_connection / latin1 /
/ character_set_database / latin1 /
/ character_set_filesystem / binary /
/ character_set_results / latin1 /
/ character_set_server / latin1 /
/ character_set_system / utf8 /
/ character_sets_dir / /usr/share/mysql/charsets/ /
+--------------------------+----------------------------+
然后,查询mysql官网,对于该问题的解决办法如下:http://dev.mysql.com/doc/refman/5.0/en/charset-configuration.html
------------------------------------------------------------------------------------------------------------------------------------
[client]
character-sets-dir=/usr/local/mysql/share/mysql/charsets
[client]
character-sets-dir=\"C:/Program Files/MySQL/MySQL Server 5.0/share/charsets\"
Character set \'charset_name\' is not a compiled character set and is not
specified in the \'/usr/share/mysql/charsets/Index.xml\' file
[client]
default-character-set=charset_name
-----------------------------------------------------------------------------------------------------------------------------------
问题应该算是清晰了.按照我的理解,linux cron 在编译shell脚本的时分,应该采用的是latin1字符集.而这里却运用UTF-8,导致编码不支持.
遂联系那儿运维,取得了my.cnf,以及mysql的root权限.
5.修正:
vi /etc/my.cnf
在[client]下添加
default-character-set=latin1
在[mysqld]下添加
default-character-set=latin1
重启mysql
------------------------------------------------------------------------------------------------------------------------------------
开启mysql指令:
/usr/local/mysql/bin
./mysqld_safe &
关闭mysql服务的指令是:
./mysqladmin -u root -p shutdown