[root@master ~]# kubectl exec -it devops-mysql-59b68c47d4-ttbng bash -n devops
kubectl exec [POD] [COMMAND] is DEPRECATED and will be removed in a future version. Use kubectl exec [POD] -- [COMMAND] instead.
root@devops-mysql-59b68c47d4-ttbng:/# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.Commands end with ; or \g.
Your MySQL connection id is 13
Server version: 5.7.36 MySQL Community Server (GPL)Copyright (c) 2000, 2021, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql|
| performance_schema |
| sys|
+--------------------+
5 rows in set (0.01 sec)mysql>
5 至此,数据库已经安装完成,然后即可通过ip+端口,这里是30001,进行数据库链接了
到此这篇关于使用Kubernetes集群环境部署MySQL数据库的文章就介绍到这了,更多相关Kubernetes部署MySQL内容请搜索以前的文章或继续浏览下面的相关文章希望大家以后多多支持!