在Travis CI

时间:2016-04-07 16:28:07

标签: mysql travis-ci

尝试在MariaDB中为Travis-CI构建设置小写表名称

addons:
  mariadb: '10.1'

我试过

  - sudo sed -i '/\[mysqld\]/a lower_case_table_names = 2 ' /etc/mysql/my.cnf
  - sudo service mysql restart

  -  echo "[mysqld]" > .my.cnf
  -  echo "lower_case_table_names = 2" >> .my.cnf

如果我跑:

  - mysql --verbose -e  "show variables like 'lower%';" --user=root

--------------
show variables like 'lower%'
--------------
+------------------------+-------+
| Variable_name          | Value |
+------------------------+-------+
| lower_case_file_system | OFF   |
| lower_case_table_names | 0     |
+------------------------+-------+

这些是文件(在修改之前运行)没有文件中的lower_case_table_names(除非我添加它)

#  - strace mysql 2>&1 | grep cnf
#stat("/etc/my.cnf", 0x7ffef7c8dca0)     = -1 ENOENT (No such file or directory)
#stat("/etc/mysql/my.cnf", {st_mode=S_IFREG|0644, st_size=5232, ...}) = 0
#open("/etc/mysql/my.cnf", O_RDONLY|O_CLOEXEC) = 3
#stat("/etc/mysql/conf.d/mariadb.cnf", {st_mode=S_IFREG|0644, st_size=435, ...}) = 0
#open("/etc/mysql/conf.d/mariadb.cnf", O_RDONLY|O_CLOEXEC) = 4
#stat("/etc/mysql/conf.d/mysqld_safe_syslog.cnf", {st_mode=S_IFREG|0644, st_size=36, ...}) = 0
#open("/etc/mysql/conf.d/mysqld_safe_syslog.cnf", O_RDONLY|O_CLOEXEC) = 4
#stat("/etc/mysql/conf.d/tokudb.cnf", {st_mode=S_IFREG|0644, st_size=285, ...}) = 0
#open("/etc/mysql/conf.d/tokudb.cnf", O_RDONLY|O_CLOEXEC) = 4
#stat("/home/travis/.my.cnf", 0x7ffef7c8dca0) = -1 ENOENT (No such file or directory)

1 个答案:

答案 0 :(得分:0)

似乎某处有一个doco错误。 这有效:

 -  echo "[mysqld]" > $HOME/.my.cnf
 -  echo "lower-case-table-names = 1" >> $HOME/.my.cnf

--------------
show variables like 'lower%'
--------------
+------------------------+-------+
| Variable_name          | Value |
+------------------------+-------+
| lower_case_file_system | OFF   |
| lower_case_table_names | 1     |
+------------------------+-------+