There is a built-in root user with administrator privilege in every MySQL deployment, but it doesn't support external access.
We can use this user to enable another full-privileged DB user.
With Cloud Director Data Solutions extension, the MySQL deployment is deployed into a TKGm Kubernetes cluster in Cloud Director tenant organization.
Make sure you can run kubectl command to work with your TKGm Kubernetes cluster.
- For additional information on using kubectl, see the Kubectl Guide below.
- For additional information on managing your Kubernetes cluster, see the Kubernetes Container Clusters UI Plug-in for VMware Cloud Director below, specifically the "How do I Manage My clusters" section.
- Find DB root user's password by command
- kubectl get secret -n vcd-ds-workloads.
- You are looking to verify the value for <MYSQL_INSTANCE_NAME>-credentials.
- Connect to the MySQL container
- kubectl exec -it <mysql_instance_name>-0 -n vcd-ds-workloads -c mysql -- bash.
- If unsure, you can locate the name of the Instance with the Cloud Director UI by going to the Instances section of the Data Solutions plugin.
- Follow Accessing VMware SQL with MySQL for Kubernetes Instances to get the root access for your MySQL deployment.
- You can either grant admin privileges to the existing user mysqlappuser, or create another DB user with admin privileges.
Granting Admin Privileges
mysql> GRANT ALL PRIVILEGES ON * . * TO 'mysqlappuser'@'%';
mysql> FLUSH PRIVILEGES;
Creating another DB User with Admin Privileges
mysql> CREATE USER 'new_user'@'%' IDENTIFIED BY 'user_password';
mysql> GRANT ALL PRIVILEGES ON * . * TO 'new_user'@'%';
mysql> FLUSH PRIVILEGES;