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. 排序算法整理C++(初赛)

    排序算法整理 常见考点 将一个乱掉的字符串排回有序(以交换为基本操作)的最少操作,就是冒泡排序. 排序算法的稳定性 排序算法的时间复杂度 排序算法的稳定性 稳定性是指排序前两个元素a1 = a2,a1 ...

  2. Java 加载、编辑和保存WPS表格文件(.et/.ett)

    WPS表格文件是金山开发的专门用于处理表格数据的Office工具,属于WPS Office中WPS文字.WPS表格和WPS演示三大功能模块之一.通常以.et和.ett作为文件后缀.我们在通过后端来操作 ...

  3. 使用KVM的图形化界面安装centos7虚拟机

    前提条件 1.宿主机上已经安装KVM的图形化管理软件,参考网址:https://www.cnblogs.com/sanduzxcvbnm/p/15538881.html 2.宿主机上安装vnc服务器, ...

  4. 不能获取到镜像,ImagePullBackoff或者Pending

    Pending 应用长时间处于 Pending 状态时,也可以按照这个办法查看镜像的下载进度. 安装 Kubernetes 过程中,或者向 Kubernetes 部署应用的过程中,有可能会碰到 Ima ...

  5. shell脚本中执行source命令不生效的解决办法

    一个shell脚本文件中有一个source命令,使用bash a.sh命令执行后source命令进行验证没有生效. 这是因为在shell脚本中执行source会看到效果,但是shell脚本执行完后再次 ...

  6. Docker安装部署Rancher

    # 一.Rancher简介 [Rancher](https://www.cnrancher.com/rancher/)是一个开源的企业级容器管理平台.通过Rancher,企业再也不必自己使用一系列的开 ...

  7. Java开发学习(三十六)----SpringBoot三种配置文件解析

    一. 配置文件格式 我们现在启动服务器默认的端口号是 8080,访问路径可以书写为 http://localhost:8080/books/1 在线上环境我们还是希望将端口号改为 80,这样在访问的时 ...

  8. [题解] Codeforces 1349 D Slime and Biscuits 概率,推式子,DP,解方程

    题目 神题.很多东西都不知道是怎么凑出来的,随意设置几个变量,之间就产生了密切的关系.下次碰到这种题应该还是不会做罢. 令\(E_x\)为最后结束时所有的饼干都在第x个人手中的概率*时间的和.\(an ...

  9. 关于csh-C-shell的记录

    csh,由柏克莱大学的 Bill Joy 设计的,语法有点类似C语言,所以才得名为 C shell ,简称为 csh Bill Joy 是一个风云人物,他创立了 BSD 操作系统,开发了 vi 编辑器 ...

  10. 关于history.back()、history.go()回退但无法刷新页面的问题

    window.history.back(); 这样确实可以做到后退的功能,但是项目中,常常并不只是后退就能完成需求,往往需要在后退的同时,刷新后退的页面信息,比如后退到首页同时刷新首页的最新数据,这样 ...