简体   繁体   English

MySQL lower_case_table_names = 1 with Kubernetes yml File,MySQL 服务器启动错误

[英]MySQL lower_case_table_names = 1 with Kubernetes yml File, MySQL server start up error

I am using yo jhipster:kubernetes to generate kubernetes file, i want to set lower_case_table_names=1 for MySQL to make MySQL case insensitive.我正在使用yo jhipster:kubernetes来生成 kubernetes 文件,我想为MySQL设置lower_case_table_names=1以使MySQL不区分大小写。 Below File is generated by command下面的文件是由命令生成的

apiVersion: extensions/v1beta1
kind: Deployment
metadata
name: app-mysql
spec:
replicas: 1
template:
metadata:
labels:
app: app-mysql
spec:
volumes:
  - name: data
    emptyDir: {}
  containers:
  - name: mysql
    image: mysql:5.6.22
    env:
    - name: MYSQL_USER
      value: root
    - name: MYSQL_ALLOW_EMPTY_PASSWORD
      value: 'yes'
    - name: MYSQL_DATABASE
      value: app
    command:
    - mysqld
    - --lower_case_table_names=1
    - --skip-ssl
    ports:
    - containerPort: 3306
    volumeMounts:
    - name: data
      mountPath: /var/lib/mysql/
apiVersion: v1
kind: Service
metadata:
name: app-mysql
spec:
selector:
app: app-mysql
ports:
port: 3306

MySQL is not starting i am getting below error on MySQL startup on linux machine due to command node in file:- MySQL未启动,由于文件中的命令节点,我在 linux 机器上启动MySQL时出现以下错误:-

       2016-10-09 10:08:35 1 [Note] Plugin 'FEDERATED' is disabled. mysqld: 
    Table 'mysql.plugin' doesn't exist 2016-10-09 10:08:35 1 
    [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it. 2016-10-09 10:08:35 1 
    [Note] InnoDB: Using atomics to ref count buffer pool pages 2016-10-09 10:08:35 1 [Note] InnoDB: The InnoDB memory heap is disabled 2016-10-09 10:08:35 1 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 2016-10-09 10:08:35 1 [Note] 
    InnoDB: Memory barrier is not used 2016-10-09 10:08:35 1 [Note] InnoDB: Compressed tables use zlib 1.2.7 2016-10-09 10:08:35 1 [Note] InnoDB: Using Linux native AIO 2016-10-09 10:08:35 1 
[Note] InnoDB: Using CPU crc32 instructions 2016-10-09 10:08:35 1 
[Note] InnoDB: Initializing buffer pool, size = 128.0M 2016-10-09 10:08:35 1 
[Note] InnoDB: Completed initialization of buffer pool 2016-10-09 10:08:35 1 
[Note] InnoDB: Highest supported file format is Barracuda. 2016-10-09 10:08:35 1 
[Note] InnoDB: Log scan progressed past the checkpoint lsn 49463 2016-10-09 10:08:35 1 
[Note] InnoDB: Database was not shutdown normally! 2016-10-09 10:08:35 1 
[Note] InnoDB: Starting crash recovery. 2016-10-09 10:08:35 1 [Note] InnoDB: Reading tablespace information from the .ibd files... 2016-10-09 10:08:35 1 
[Note] InnoDB: Restoring possible half-written data pages 2016-10-09 10:08:35 1 
[Note] InnoDB: from the doublewrite buffer... InnoDB: Doing recovery: scanned up to log sequence number 1600607 2016-10-09 10:08:35 1 
[Note] InnoDB: Starting an apply batch of log records to the database... InnoDB: Progress in percent: 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 InnoDB: Apply batch completed 2016-10-09 

10:08:35 1 [Note] InnoDB: 128 rollback segment(s) are active. 2016-10-09 10:08:35 1 [Note] InnoDB: Waiting for purge to start 2016-10-09 10:08:35 1 

[Note] InnoDB: 5.6.22 started; log sequence number 1600607 2016-10-09 10:08:35 1 [Note] Server hostname (bind-address): '*'; port: 3306 2016-10-09 10:08:35 1 [Note] IPv6 is available. 2016-10-09 10:08:35 1 
[Note] - '::' resolves to '::'; 2016-10-09 10:08:35 1 [Note] Server socket created on IP: '::'. 2016-10-09 10:08:35 1 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist

any idea how to set lower_case_table_names=1 in kubernetes yml file?知道如何在 kubernetes yml 文件中设置lower_case_table_names=1吗?

Could you try using args instead of command ?您可以尝试使用args而不是command吗? That is to say,也就是说,

args:
- --lower_case_table_names=1
- --skip-ssl

If it still doesn't work, how about creating a config volume?如果它仍然不起作用,如何创建一个配置卷? In your yaml file on mysql pod, you can define like在 mysql pod 上的 yaml 文件中,您可以定义类似

spec:
      containers:
      - name: mysql
        image:  mysql:5.6
        imagePullPolicy: IfNotPresent
        volumeMounts:
        - mountPath: /var/lib/mysql
          name: data
        - mountPath: /etc/mysql/conf.d/
          name: config
          readOnly: true
        ports:
        - containerPort: 3306
        env:
        - name: MYSQL_ALLOW_EMPTY_PASSWORD
          value: "yes"
      volumes:
      - name: data
        hostPath:
          path: /var/lib/data
      - name: config
        configMap:
          name: mysql-config

And then you can pass additional config parameters by loading mysql-config written as然后你可以通过加载mysql-config来传递额外的配置参数

apiVersion: v1
kind: ConfigMap
metadata:
  name: mysql-config
data:
  my.conf: |
    [mysqld]
    lower_case_table_names=1
    skip_ssl

Then no modification of command or args values on kuberenetes yaml required.然后不需要修改 kuberenetes yaml 上的commandargs值。 At least on our local development environment, we can change as innodb_file_format=barracuda in the latter way.至少在我们本地的开发环境中,我们可以将后一种方式改为innodb_file_format=barracuda

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM