radondb-mysql-kubernetes icon indicating copy to clipboard operation
radondb-mysql-kubernetes copied to clipboard

How do I customize and initialize a database

Open Heyz6 opened this issue 1 year ago • 4 comments

If I need to execute init. SQL to initialize the database I need when the database is created, what should I do? In addition, why does the database refuse me to use root -h to log in to the sample-leader

| % | radondb_metrics | | % | radondb_operator | | % | radondb_repl | | % | root | | 127.0.0.1 | root | | localhost | mysql.infoschema | | localhost | mysql.session | | localhost | mysql.sys | | localhost | root | +-----------+------------------+ 10 rows in set (0.00 sec)

mysql> show grants for root\G; *************************** 1. row *************************** Grants for root@%: GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE, CREATE ROLE, DROP ROLE ON . TO root@% WITH GRANT OPTION *************************** 2. row *************************** Grants for root@%: GRANT APPLICATION_PASSWORD_ADMIN,AUDIT_ADMIN,BACKUP_ADMIN,BINLOG_ADMIN,BINLOG_ENCRYPTION_ADMIN,CLONE_ADMIN,CONNECTION_ADMIN,ENCRYPTION_KEY_ADMIN,FLUSH_OPTIMIZER_COSTS,FLUSH_STATUS,FLUSH_TABLES,FLUSH_USER_RESOURCES,GROUP_REPLICATION_ADMIN,INNODB_REDO_LOG_ARCHIVE,INNODB_REDO_LOG_ENABLE,PERSIST_RO_VARIABLES_ADMIN,REPLICATION_APPLIER,REPLICATION_SLAVE_ADMIN,RESOURCE_GROUP_ADMIN,RESOURCE_GROUP_USER,ROLE_ADMIN,SERVICE_CONNECTION_ADMIN,SESSION_VARIABLES_ADMIN,SET_USER_ID,SHOW_ROUTINE,SYSTEM_USER,SYSTEM_VARIABLES_ADMIN,TABLE_ENCRYPTION_ADMIN,XA_RECOVER_ADMIN ON . TO root@% WITH GRANT OPTION

Database Login Commands bash-4.4$ mysql -h sample-leader.default -uroot -pAa@123123123 mysql: [Warning] Using a password on the command line interface can be insecure. ERROR 1045 (28000): Access denied for user 'root'@'10.170.10.44' (using password: YES)

Heyz6 avatar Aug 03 '22 09:08 Heyz6

  1. Customized init.sql (wip)
  2. Access to root user remotely is not safe. At present, root@% is for Operator only. If you need to use super users remotely, you can create an additional super user

runkecheng avatar Aug 03 '22 09:08 runkecheng

Hello developers @runkecheng 1、https://github.com/radondb/radondb-mysql-kubernetes/releases/download/v2.2.0/mysql_v1alpha1_mysqlcluster_mysql8.yaml Whether this file supports database initialization? 2、Customized init.sql (wip) Could you give me some guidance? 3、persistence If I don't use PVC, I just want to use the local HostPath support

Heyz6 avatar Aug 03 '22 09:08 Heyz6

Hello developers @runkecheng 1、https://github.com/radondb/radondb-mysql-kubernetes/releases/download/v2.2.0/mysql_v1alpha1_mysqlcluster_mysql8.yaml Whether this file supports database initialization? 2、Customized init.sql (wip) Could you give me some guidance? 3、persistence If I don't use PVC, I just want to use the local HostPath support

For 1,2: We are developing this feature, It is expected to be supported in the next version For hostpath: It is not conflicting to use both hostpath and PVC. You can use the local-hostpath storageclass of OpenEBS(refer https://openebs.io/docs/user-guides/localpv-hostpath)

runkecheng avatar Aug 03 '22 09:08 runkecheng

Regarding the first and second points, I am looking forward to your support as soon as possible, which will be more flexible. For the third point, I will take your advice. Thank you very much. @runkecheng

Heyz6 avatar Aug 03 '22 09:08 Heyz6