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上,用 ...
随机推荐
- 使用STM32控制TMC5160驱动步进电机
首先先来了解一下TMC5160的3种工作模式 TMC5160通过两个引脚来控制它的工作模式:SD_MODE和SPI_MODE. 1.当SD_MODE接地,SPI_MODE拉高,TMC5160即工作在模 ...
- ELK套件部署
前言 经过两周的不断碰壁,版本的选择 最终选择ELK的7.6.1套餐 因为我所需要的的警报插件sentinl也才跟新到7.6.1 运行环境:centos7 需要开放的端口:5601,9200,514( ...
- 【设计模式】Java设计模式 - 外观模式
Java设计模式 - 外观模式 不断学习才是王道 继续踏上学习之路,学之分享笔记 总有一天我也能像各位大佬一样 原创作品,更多关注我CSDN: 一个有梦有戏的人 准备将博客园.CSDN一起记录分享自己 ...
- Django 连接数据库 MySQL
一.Django 连接 MySQL 修改 settings.py 文件 # 默认用的是sqlite3 # Database # https://docs.djangoproject.com/en/4. ...
- 视频结构化 AI 推理流程
「视频结构化」是一种 AI 落地的工程化实现,目的是把 AI 模型推理流程能够一般化.它输入视频,输出结构化数据,将结果给到业务系统去形成某些行业的解决方案. 换个角度,如果你想用摄像头来实现某些智能 ...
- crictl 命令 - Kubernetes 管理命令详解
描述:crictl 是 CRI 兼容的容器运行时命令行对接客户端, 你可以使用它来检查和调试 Kubernetes 节点上的容器运行时和应用程序.由于该命令是为k8s通过CRI使用containerd ...
- Confluence预览中文附件出现乱码
转载自:https://blog.51cto.com/u_13776519/5329428 背景介绍: 1.使用docker方式安装运行的Confluence 2.进行了破解,使用外置数据库 3.do ...
- filebeat直接给es传输日志,自定义索引名
ElasticStack从2019年1月29日的6.6.0版本的开始,引入了索引生命周期管理的功能,新版本的Filebeat则默认的配置开启了ILM,导致索引的命名规则被ILM策略控制. 加上这个配置 ...
- Traefik知识点
Traefik 的各种 Providers Traefik 中的配置发现是通过下面的一些 providers 来实现的. providers 是现有的一些基础架构组件,可以是编排工具,容器引擎,云提供 ...
- aardio + AutoHotkey 混合编程
本文主要介绍 aardio + AutoHotkey 混合编程. 在 aardio 中可以调用很多编程语言,例如 C语言.C++.C#.Java.Python.R.Javascript.Node.Js ...