mysql管理工具mysqladmin的使用
1. 初始化密码
mysqladmin -uroot -p'password' password 'new-password'
[root@controller3 ~]# yum -y install mariadb
......
[root@controller3 ~]# systemctl start mariadb
[root@controller3 ~]# mysqladmin -uroot password '123456' #mariadb默认无初始密码,mysql可能需要去/var/log/mysqld.log查找初始密码
[root@controller3 ~]# mysql -uroot
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
[root@controller3 ~]# mysql -uroot -p123456
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 27
Server version: 10.3.28-MariaDB MariaDB Server Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> exit
Bye
[root@controller3 ~]#
2. 创建,查看,删除数据库
mysqladmin -uroot -p create test_db
mysqlshow -uroot -p
mysqladmin -uroot -p drop test_db -f
[root@test234 ~]# mysqladmin -uroot -p create test_db
Enter password:
[root@test234 ~]# mysqlshow -uroot -p
Enter password:
+--------------------+
| Databases |
+--------------------+
| django |
| information_schema |
| mysql |
| performance_schema |
| sys |
| test_db |
+--------------------+
[root@test234 ~]# mysqladmin -uroot -p drop test_db
Enter password:
Dropping the database is potentially a very bad thing to do.
Any data stored in the database will be destroyed. Do you really want to drop the 'test_db' database [y/N] yes
Database "test_db" dropped
[root@test234 ~]# mysqlshow -uroot -p
Enter password:
+--------------------+
| Databases |
+--------------------+
| django |
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
[root@test234 ~]#
[root@test234 ~]# mysqladmin -uroot -p create test_db
Enter password:
[root@test234 ~]# mysqlshow -uroot -p
Enter password:
+--------------------+
| Databases |
+--------------------+
| django |
| information_schema |
| mysql |
| performance_schema |
| sys |
| test_db |
+--------------------+
[root@test234 ~]# mysqladmin -uroot -p -f drop test_db
Enter password:
Database "test_db" dropped
[root@test234 ~]# mysqladmin -uroot -p create test_db
Enter password:
[root@test234 ~]# mysqladmin -uroot -p drop test_db --force
Enter password:
Database "test_db" dropped
mysqlshow -uroot -p database_name


[root@test234 ~]# mysqlshow -uroot -p django
Enter password:
Database: django
+----------------------------+
| Tables |
+----------------------------+
| auth_group |
| auth_group_permissions |
| auth_permission |
| auth_user |
| auth_user_groups |
| auth_user_user_permissions |
| django_admin_log |
| django_content_type |
| django_migrations |
| django_session |
+----------------------------+ [root@test234 ~]# mysqlshow -uroot -p mysql
Enter password:
Database: mysql
+------------------------------------------------------+
| Tables |
+------------------------------------------------------+
| columns_priv |
| component |
| db |
| default_roles |
| engine_cost |
| func |
| general_log |
| global_grants |
| gtid_executed |
| help_category |
| help_keyword |
| help_relation |
| help_topic |
| innodb_index_stats |
| innodb_table_stats |
| password_history |
| plugin |
| procs_priv |
| proxies_priv |
| replication_asynchronous_connection_failover |
| replication_asynchronous_connection_failover_managed |
| replication_group_configuration_version |
| replication_group_member_actions |
| role_edges |
| server_cost |
| servers |
| slave_master_info |
| slave_relay_log_info |
| slave_worker_info |
| slow_log |
| tables_priv |
| time_zone |
| time_zone_leap_second |
| time_zone_name |
| time_zone_transition |
| time_zone_transition_type |
| user |
+------------------------------------------------------+
[root@test234 ~]# mysqlshow -uroot -p django -v
Enter password:
Database: django
+----------------------------+----------+
| Tables | Columns |
+----------------------------+----------+
| auth_group | 2 |
| auth_group_permissions | 3 |
| auth_permission | 4 |
| auth_user | 11 |
| auth_user_groups | 3 |
| auth_user_user_permissions | 3 |
| django_admin_log | 8 |
| django_content_type | 3 |
| django_migrations | 4 |
| django_session | 3 |
+----------------------------+----------+
10 rows in set. [root@test234 ~]# mysqlshow -uroot -p django -vv
Enter password:
Database: django
+----------------------------+----------+------------+
| Tables | Columns | Total Rows |
+----------------------------+----------+------------+
| auth_group | 2 | 0 |
| auth_group_permissions | 3 | 0 |
| auth_permission | 4 | 24 |
| auth_user | 11 | 0 |
| auth_user_groups | 3 | 0 |
| auth_user_user_permissions | 3 | 0 |
| django_admin_log | 8 | 0 |
| django_content_type | 3 | 6 |
| django_migrations | 4 | 18 |
| django_session | 3 | 0 |
+----------------------------+----------+------------+
10 rows in set.
mysql管理工具mysqladmin的使用的更多相关文章
- 涂抹mysql笔记-mysql管理工具
五花八门的mysql管理工具<>mysql提供的命令行工具 mysql_install_db:mysql建库工具,在源码安装mysql环节我们使用过. mysql_safe:mysql启动 ...
- 三十二. 多表查询 MySQL管理工具 、 用户授权及撤销
1.MySQL管理工具 部署LAMP+phpMyAdmin平台 安装httpd.mysql.php-mysql及相关包 启动httpd服务程序 解压phpMyAdmin包,部署到网站目录 配置conf ...
- Database基础(四):密码恢复及设置、 用户授权及撤销、数据备份与恢复、MySQL管理工具
一.密码恢复及设置 目标: 本案例要求熟悉MySQL管理密码的控制,完成以下任务操作: 练习重置MySQL管理密码的操作 通过正常途径设置MySQL数据库的管理密码 步骤: 步骤一:重置MySQL管理 ...
- 15款最佳的MySQL管理工具和应用程序
工欲善其事,必先利其器.几乎每个开发人员都有最钟爱的 MySQL 管理工具,它帮助开发人员在许多方面支持包括 PostgreSQL,MySQL,SQLite,Redis,MongoDB 等在内的多种数 ...
- mysql 管理工具
摘自: http://www.chinaz.com/free/2009/0306/68691.shtml MySQL是一个非常流行的小型关系型数据库管理系统,2008年1月16号被Sun公司收购.目前 ...
- MySQL管理工具HeidiSQL
MySQL管理工具HeidiSQL HeidiSQL 是一个功能非常强大的 MySQL 客户端软件.它是德国程序员Ansgar Becker和几个Delphi程序员开发的一个开源工具.要通过Hei ...
- 分享几款常用的MySQL管理工具
MySQL数据库以体积小.速度快.总体拥有成本低等优点,深受广大中小企业的喜爱,像我们常见的MySQL管理工具都有那些呢?下面给大家推荐六个常用的MySQL管理工具! phpMyAdmin ...
- 五大好用的开源MySQL管理工具推荐
众所周知,对于数据库管理工作者(DBA)来说,保持数据正常运行在最佳状态需要具备敏捷.专注.冷静和快速的反应能力.因为数据库几乎是所有应用程序成功运行的核心,由于DBA负责组织数据,因此寻找可靠的工具 ...
- MySQL管理工具MySQL Utilities — 介绍与安装(1)
MySQL Utilities介绍 MySQL Utilities 提供一组命令行工具用于维护和管理 MySQL 服务器,包括: 管理工具 (克隆.复制.比较.差异.导出.导入) 复制工具 (安装.配 ...
- mac上的mysql管理工具sequel pro
https://blog.csdn.net/wan_zaiyunduan/article/details/54909389 以前用过Plsql.Navicat.Workbench,现在换到mac上,用 ...
随机推荐
- 如何不编写 YAML 管理 Kubernetes 应用?
Kubernetes 将自身边界内的事物都抽象为资源.其中的主要部分,是以 Deployment.StatefulSet 为代表的 workload 工作负载控制器,其他各类资源都围绕这些主要的资源工 ...
- 【面试题】js实现将excel表格copy到页面
js实现将excel表格copy到页面 点击打开视频讲解更加详细 其实最核心的技术,还是copy的是我们粘贴板上的数据 就像平常怎么粘贴复制其他的数据一样,只是我们在excel粘贴的是一个表格数据 这 ...
- 谣言检测——《MFAN: Multi-modal Feature-enhanced Attention Networks for Rumor Detection》
论文信息 论文标题:MFAN: Multi-modal Feature-enhanced Attention Networks for Rumor Detection论文作者:Jiaqi Zheng, ...
- Lua 支持虚函数的解决方案
概述 lua本身没有提供类似C++虚函数机制,调用的父类方法调用虚函数可能会出现问题. 问题分析 分析这段代码和输出 local Gun = {} -- 示例,实际应用还要考虑构造,虚表等情况 fun ...
- ES配置生成SSL使用的证书
cd /usr/local/elasticsearch/bin/ ./elasticsearch-certgen ##################################### Pleas ...
- 使用kubeoperator安装的k8s集群以及采用的containerd容器运行时,关于采用的是cgroup 驱动还是systemd 驱动的说明
使用kubeoperator安装的k8s集群,默认使用的是systemd驱动 # kubectl get cm -n kube-system NAME DATA AGE calico-config 4 ...
- 使用 EFKLK 搭建 Kubernetes 日志收集工具栈
转载自:https://mp.weixin.qq.com/s?__biz=MzU4MjQ0MTU4Ng==&mid=2247491992&idx=1&sn=a770252759 ...
- 利用分层机制优化 Docker Image
文章转载自:https://mp.weixin.qq.com/s/FrIOIquHVsCTEMfHiF87MA 假设系统中我们有两个应用 App1 和 App2.这两个节点的环境信息如下: 通过上表环 ...
- Elastic:使用Kafka部署Elastic Stack
- Loki日志系统基础知识
文章摘抄转载自:https://lluozh.blog.csdn.net/article/details/111027998 Loki 日志系统由以下3个部分组成: loki是主服务器,负责存储日志和 ...