我想在UNIX上为MySQL添加额外的配置文件,我们称之为my2.cnf.所以当MySQL启动时,它也会读取该文件的选项.
这里它说我可以把文件放在以下地方:
我想要这样的"default-extra-file",但是避免在mysql提示符下输入这个命令.
cnf文件中有一个选项,如:
extra-conf-file=/path/to/my/file/my2.cnf
Run Code Online (Sandbox Code Playgroud)
(不幸的是,这不起作用)
这甚至可能吗?我可以使用默认的my.cnf文件添加另一个配置文件,当我启动itysql服务时将会读取该文件吗?
(使用$ MYSQL_HOME/my.cnf对我来说已经足够了,但是我想知道我是否可以根据主要的my.cnf全局文件进行说明,以便可以读取或忽略它).
我有一个Python脚本,用UTF-8编码写一些字符串.在我的脚本中,我主要使用str()函数来强制转换为字符串.它看起来像这样:
mystring="this is unicode string:"+japanesevalues[1]
#japanesevalues is a list of unicode values, I am sure it is unicode
print mystring
Run Code Online (Sandbox Code Playgroud)
我不使用Python终端,只使用标准的Linux Red Hat x86_64终端.我设置终端输出utf8字符.
如果我执行这个:
#python myscript.py
this is unicode string: ????? ????
Run Code Online (Sandbox Code Playgroud)
但如果我这样做:
#python myscript.py > output
Run Code Online (Sandbox Code Playgroud)
我得到了典型的错误:
UnicodeEncodeError: 'ascii' codec can't encode characters in position 253-254: ordinal not in range(128)
Run Code Online (Sandbox Code Playgroud)
这是为什么?