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的使用的更多相关文章

  1. 涂抹mysql笔记-mysql管理工具

    五花八门的mysql管理工具<>mysql提供的命令行工具 mysql_install_db:mysql建库工具,在源码安装mysql环节我们使用过. mysql_safe:mysql启动 ...

  2. 三十二. 多表查询 MySQL管理工具 、 用户授权及撤销

    1.MySQL管理工具 部署LAMP+phpMyAdmin平台 安装httpd.mysql.php-mysql及相关包 启动httpd服务程序 解压phpMyAdmin包,部署到网站目录 配置conf ...

  3. Database基础(四):密码恢复及设置、 用户授权及撤销、数据备份与恢复、MySQL管理工具

    一.密码恢复及设置 目标: 本案例要求熟悉MySQL管理密码的控制,完成以下任务操作: 练习重置MySQL管理密码的操作 通过正常途径设置MySQL数据库的管理密码 步骤: 步骤一:重置MySQL管理 ...

  4. 15款最佳的MySQL管理工具和应用程序

    工欲善其事,必先利其器.几乎每个开发人员都有最钟爱的 MySQL 管理工具,它帮助开发人员在许多方面支持包括 PostgreSQL,MySQL,SQLite,Redis,MongoDB 等在内的多种数 ...

  5. mysql 管理工具

    摘自: http://www.chinaz.com/free/2009/0306/68691.shtml MySQL是一个非常流行的小型关系型数据库管理系统,2008年1月16号被Sun公司收购.目前 ...

  6. MySQL管理工具HeidiSQL

    MySQL管理工具HeidiSQL   HeidiSQL 是一个功能非常强大的 MySQL 客户端软件.它是德国程序员Ansgar Becker和几个Delphi程序员开发的一个开源工具.要通过Hei ...

  7. 分享几款常用的MySQL管理工具

    MySQL数据库以体积小.速度快.总体拥有成本低等优点,深受广大中小企业的喜爱,像我们常见的MySQL管理工具都有那些呢?下面给大家推荐六个常用的MySQL管理工具!      phpMyAdmin  ...

  8. 五大好用的开源MySQL管理工具推荐

    众所周知,对于数据库管理工作者(DBA)来说,保持数据正常运行在最佳状态需要具备敏捷.专注.冷静和快速的反应能力.因为数据库几乎是所有应用程序成功运行的核心,由于DBA负责组织数据,因此寻找可靠的工具 ...

  9. MySQL管理工具MySQL Utilities — 介绍与安装(1)

    MySQL Utilities介绍 MySQL Utilities 提供一组命令行工具用于维护和管理 MySQL 服务器,包括: 管理工具 (克隆.复制.比较.差异.导出.导入) 复制工具 (安装.配 ...

  10. mac上的mysql管理工具sequel pro

    https://blog.csdn.net/wan_zaiyunduan/article/details/54909389 以前用过Plsql.Navicat.Workbench,现在换到mac上,用 ...

随机推荐

  1. 微服务系列之网关(二) konga配置操作

    1.konga核心对象 Kong 的四大核心对象:upstream,target,service,route.下面分别说: (1)upstream,字面意思上游,实际项目理解是对某一个服务的一个或者多 ...

  2. React版/Vue版都齐了,开源一套【特别】的后台管理系统...

    本项目主要基于Elux+Antd构建,包含React版本和Vue版本,旨在提供给大家一个简单基础.开箱即用的后台管理系统通用模版,主要包含运行环境.脚手架.代码风格.基本Layout.状态管理.路由管 ...

  3. Java SE 3、封装

    封装 封装的好处 隐藏实现细节 可以对数据进行验证,保证安全合理 实现步骤 将属性进行私有化private 提供一个公共的(public)set方法,用于对属性判断并赋值 public void se ...

  4. Elasticsearch:使用 IP 过滤器限制连接

    文章转载自:https://elasticstack.blog.csdn.net/article/details/107154165

  5. shell分割字符串并赋值给变量

    假如变量var的值为:num=12,也即var="num=12",现在想把 12赋值给变量id awk 的-F 后跟上要分割字符串时的指定分隔符 awk中$0是要分割的字符串,$1 ...

  6. Grafana 入门知识介绍

    通过[Configuration]>[Plugins]添加插件 通过[Configuration]>[Data Sources]添加数据源(分析对象) 通过[Server Admin]&g ...

  7. Fluentd部署:错误排查

    介绍一下排查Fluentd运行时错误的几种方法. 查看日志 如果感觉Fluentd运行异常,请先查看日志.td-agent安装后,默认日志存放在/var/log/td-agent/td-agent.l ...

  8. .NET 反向代理 YARP 自定义配置提供程序(Configuration Providers)

    介绍 基本 Yarp 示例显示从 appsettings.json 加载的代理配置.相反,代理配置可以从您选择的源以编程方式加载.您可以通过提供几个实现 IProxyConfigProvider 和 ...

  9. Intellij IDEA个人常用快捷键

    分享一下个人常用快捷键. 说明:字母排序规则遵循字母表(a->z) 快捷键 介绍 ctrl+b 快速打开当前光标处的类或方法 ctrl+d 复制当前光标所在行至下一行 ctrl+e 打开最近的文 ...

  10. DevExpress弹框、右键菜单、Grid的使用

    很重要!!!Dev为了区分winform的命名,会把一些新添加的属性放在Properties对象里!!找不到想要的属性,记得到里面找找哦! 一.下拉框 在这里假设我们的数据源是db.List(),在这 ...