电脑知识|欧美黑人一区二区三区|软件|欧美黑人一级爽快片淫片高清|系统|欧美黑人狂野猛交老妇|数据库|服务器|编程开发|网络运营|知识问答|技术教程文章 - 好吧啦网

您的位置:首頁技術(shù)文章
文章詳情頁

MySQL mysqladmin客戶端的使用簡介

瀏覽:69日期:2023-10-04 12:42:58

mysqladmin是MySQL官方提供的shell命令行工具,它的參數(shù)都需要在shell命令行里面執(zhí)行,當(dāng)我們使用mysqladmin的時(shí)候,必須指定兩類參數(shù),一類是連接參數(shù),另外一類是命令參數(shù),連接參數(shù)用來指定相應(yīng)的連接信息,而命令參數(shù)用來指定命令信息,例如可以用來檢查服務(wù)器的配置和當(dāng)前狀態(tài)、創(chuàng)建和刪除數(shù)據(jù)庫等。它的語法如下:

mysqladmin [options] command [command-options] [command [command options]] ...

除此之外,還有一些相關(guān)的參數(shù)配置(代碼可以左滑哦~):

--bind-address=name 綁定遠(yuǎn)程訪問主機(jī)的ip地址-i, --sleep=# 間隔多長時(shí)間執(zhí)行一次。-c, --count=# 統(tǒng)計(jì)計(jì)數(shù)。與i選項(xiàng)配合使用。-f, --force 強(qiáng)制執(zhí)行,刪除數(shù)據(jù)庫是無需確認(rèn)信息,多條語句執(zhí)行時(shí)忽略其中某條語句的錯(cuò)誤。--default-character-set=name 設(shè)置默認(rèn)字符集。-?, --help 顯示幫助信息。-h, --host=name 指定連接主機(jī)。-u, --user=name 登錄用戶。-p, --password[=name] 登錄密碼,如果不寫于參數(shù)后,則會(huì)提示輸入。-P, --port=# 指定數(shù)據(jù)庫端口。--protocol=name 使用的連接協(xié)議。(tcp,socket,pipe,memory)-r, --relative 顯示前后兩次輸出的差異。必須與i選項(xiàng)配合使用。-s, --silent 靜默退出。-S, --socket=name 指定socket文件。-v, --verbose 顯示更多信息。-V, --version 顯示版本信息。-w, --wait[=#] 如果連接斷開,等待指定的時(shí)間后重試

這么多參數(shù),想看著比較亂,那么我們來看看它具體能夠幫我們做哪些事情吧:

1.查看服務(wù)器的狀態(tài):

#每隔兩秒查看一次服務(wù)器的狀態(tài)[root@dev01 ~]# mysqladmin -uroot -p -i 2 -c 2 statusEnter password: Uptime: 42767 Threads: 2 Questions: 533 Slow queries: 0 Opens: 346 Flush tables: Open tables: Queries per second avg: 0.012Uptime: Threads: Questions: Slow queries: Opens: Flush tables: Open tables: Queries per second avg: 0.0122.修改root密碼:

#修改root密碼mysqladmin -u root -p原密碼 password ’newpassword’3.檢查mysqlserver是否可用

#查詢服務(wù)是否正常[root@dev01 ~]# mysqladmin -uroot -p pingEnter password: mysqld is alive4.查詢服務(wù)器的版本

[root@dev01 ~]# mysqladmin -uroot -p versionEnter password: mysqladmin Ver 8.42 Distrib 5.7.19, for linux-glibc2.12 on x86_64Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Server version 5.7.19Protocol version 10Connection Localhost via UNIX socketUNIX socket /tmp/mysql.sockUptime: 12 hours 42 secThreads: 2 Questions: 538 Slow queries: 0 Opens: 346 Flush tables: 1 Open tables: 285 Queries per second avg: 0.0125.查看系統(tǒng)當(dāng)前的狀態(tài)值 (省略其中的部分結(jié)果)

[root@dev01 ~]# mysqladmin -uroot -p extended-statusEnter password: +-----------------------------------------------+----------+| Variable_name | Value |+-----------------------------------------------+----------+| Aborted_clients| || Aborted_connects| || Innodb_num_open_files | || Innodb_truncated_status_writes | | | Uptime | || Uptime_since_flush_status | |+-----------------------------------------------+----------+6.查看服務(wù)器系統(tǒng)變量值

[root@dev01 ~]# mysqladmin -uroot -p variablesEnter password: ......| key_cache_block_size | || key_cache_division_limit | || large_files_support | ON|| large_page_size | || large_pages | OFF|| lc_messages | en_US || lc_messages_dir | /usr/local/mysql/share/ |......7.查看當(dāng)前所有的進(jìn)程

[root@dev01 ~]# mysqladmin -uroot -p processlistEnter password: +----+------+----------------------+----------+---------+-------+----------+------------------+| Id | User | Host | db | Command | Time | State | Info |+----+------+----------------------+----------+---------+-------+----------+------------------+| | root | 192.168.56.102: | devopsdb | Sleep | | | || | root | localhost | | Query | | starting | show processlist |+----+------+----------------------+----------+---------+-------+----------+------------------+8.創(chuàng)建數(shù)據(jù)庫

[root@dev01 ~]# mysqladmin -uroot -p create db_testEnter password: [root@dev01 ~]# mysql -uroot -pEnter password: mysql: [Warning] Using a password on the command line interface can be insecure.Welcome to the MySQL monitor. Commands end with ; or g.Your MySQL connection id is Server version: 5.7.19 MySQL Community Server (GPL)Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type ’help;’ or ’h’ for help. Type ’c’ to clear the current input statement.mysql> show databases;+--------------------+| Database |+--------------------+| information_schema || TkGrowDB_dbo || TkGrowLog_dbo || cydevopsdb || db_test || yeyz |+--------------------+ rows in set (0.00 sec)mysql> exitBye

從上面的命令我們可以看到,我們已經(jīng)通過create命令創(chuàng)建了數(shù)據(jù)庫db_test

9.刪除特定的數(shù)據(jù)庫:

[root@dev01 ~]# mysqladmin -uroot -p drop db_testEnter 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 ’db_test’ database [y/N] yDatabase 'db_test' dropped[root@dev01 ~]# mysql -uroot -pEnter password: Welcome to the MySQL monitor. Commands end with ; or g.Your MySQL connection id is Server version: 5.7.19 MySQL Community Server (GPL)Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type ’help;’ or ’h’ for help. Type ’c’ to clear the current input statement.mysql> show databases;+--------------------+| Database |+--------------------+| information_schema || TkGrowDB_dbo || TkGrowLog_dbo || cydevopsdb || yeyz |+--------------------+ rows in set (0.00 sec)

在我們?nèi)粘2僮髦?,drop操作應(yīng)該謹(jǐn)慎一些,可以看到,mysql也友好的給出了提醒。

10.重載權(quán)限表和刷新緩存(無明顯輸出)

[root@dev01 ~]# mysqladmin -uroot -p reloadEnter password:[root@dev01 ~]# mysqladmin -uroot -p refreshEnter password:11.啟用安全模式關(guān)閉數(shù)據(jù)庫

[root@dev01 ~]# ps -ef|grep mysqldroot : ? :: /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/data/mysql --pid-file=/data/mysql/dev01.pidmysql : ? :: /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/data/mysql --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/data/mysql/mysqld.log --pid-file=/data/mysql/dev01.pid --socket=/tmp/mysql.sockroot : pts/ :: grep mysqld[root@dev01 ~]# mysqladmin -uroot -p shutdownEnter password: [root@dev01 ~]# ps -ef|grep mysqldroot : pts/ :: grep mysqld12.各種刷新命令

[root@dev01 ~]# mysqladmin -u root -ptmppassword flush-hosts[root@dev01 ~]# mysqladmin -u root -ptmppassword flush-logs[root@dev01 ~]# mysqladmin -u root -ptmppassword flush-privileges[root@dev01 ~]# mysqladmin -u root -ptmppassword flush-status[root@dev01 ~]# mysqladmin -u root -ptmppassword flush-tables[root@dev01 ~]# mysqladmin -u root -ptmppassword flush-threads13.停止和啟動(dòng)MySQL從節(jié)點(diǎn)復(fù)制過程

[root@dev01 ~]# mysqladmin -u root -p stop-slave[root@dev01 ~]# mysqladmin -u root -p start-slave

以上就是mysqladmin最常用的一些功能,標(biāo)注為紅色的一般在工作中應(yīng)用的范圍及其廣泛,可以多留意下。

以上就是MySQL mysqladmin客戶端的使用簡介的詳細(xì)內(nèi)容,更多關(guān)于MySQL mysqladmin客戶端的資料請(qǐng)關(guān)注好吧啦網(wǎng)其它相關(guān)文章!

標(biāo)簽: MySQL 數(shù)據(jù)庫
相關(guān)文章:
主站蜘蛛池模板: 布袋式除尘器|木工除尘器|螺旋输送机|斗式提升机|刮板输送机|除尘器配件-泊头市德佳环保设备 | 深圳VI设计-画册设计-LOGO设计-包装设计-品牌策划公司-[智睿画册设计公司] | 耐火浇注料-喷涂料-浇注料生产厂家_郑州市元领耐火材料有限公司 耐力板-PC阳光板-PC板-PC耐力板 - 嘉兴赢创实业有限公司 | 密封无忧网 _ 专业的密封产品行业信息网| 绿萝净除甲醛|深圳除甲醛公司|测甲醛怎么收费|培训机构|电影院|办公室|车内|室内除甲醛案例|原理|方法|价格立马咨询 | 冲锋衣滑雪服厂家-冲锋衣定制工厂-滑雪服加工厂-广东睿牛户外(S-GERT) | 作文导航网_作文之家_满分作文_优秀作文_作文大全_作文素材_最新作文分享发布平台 | 全自动包衣机-无菌分装隔离器-浙江迦南科技股份有限公司 | 家德利门业,家居安全门,别墅大门 - 安徽家德利门业有限公司 | 货车视频监控,油管家,货车油管家-淄博世纪锐行电子科技 | 气象监测系统_气象传感器_微型气象仪_气象环境监测仪-山东风途物联网 | 磁力抛光机_磁力研磨机_磁力去毛刺机_精密五金零件抛光设备厂家-冠古科技 | 小型玉石雕刻机_家用玉雕机_小型万能雕刻机_凡刻雕刻机官网 | 衬四氟_衬氟储罐_四氟储罐-无锡市氟瑞特防腐科技有限公司 | 主题班会网 - 安全教育主题班会,各类主题班会PPT模板 | 南京蜂窝纸箱_南京木托盘_南京纸托盘-南京博恒包装有限公司 | 桐城新闻网—桐城市融媒体中心主办| 贴片电感_贴片功率电感_贴片绕线电感_深圳市百斯特电子有限公司 贴片电容代理-三星电容-村田电容-风华电容-国巨电容-深圳市昂洋科技有限公司 | 压力控制器,差压控制器,温度控制器,防爆压力控制器,防爆温度控制器,防爆差压控制器-常州天利智能控制股份有限公司 | 生物颗粒燃烧机-生物质燃烧机-热风炉-生物颗粒蒸汽发生器-丽水市久凯能源设备有限公司 | 宝宝药浴-产后药浴-药浴加盟-艾裕-专注母婴调养泡浴 | 磁力抛光机_磁力研磨机_磁力去毛刺机-冠古设备厂家|维修|租赁【官网】 | 顺景erp系统_erp软件_erp软件系统_企业erp管理系统-广东顺景软件科技有限公司 | led太阳能路灯厂家价格_风光互补庭院灯_农村市政工程路灯-中山华可路灯品牌 | 同学聚会纪念册制作_毕业相册制作-成都顺时针宣传画册设计公司 | 郑州外墙清洗_郑州玻璃幕墙清洗_郑州开荒保洁-河南三恒清洗服务有限公司 | 西门子伺服控制器维修-伺服驱动放大器-828D数控机床维修-上海涌迪 | 济南轻型钢结构/济南铁艺护栏/济南铁艺大门-济南燕翔铁艺制品有限公司 | 土壤检测仪器_行星式球磨仪_土壤团粒分析仪厂家_山东莱恩德智能科技有限公司 | 自动化改造_智虎机器人_灌装机_贴标机-上海圣起包装机械 | 车辆定位管理系统_汽车GPS系统_车载北斗系统 - 朗致物联 | Magnescale探规,Magnescale磁栅尺,Magnescale传感器,Magnescale测厚仪,Mitutoyo光栅尺,笔式位移传感器-苏州连达精密量仪有限公司 | 进口试验机价格-进口生物材料试验机-西安卡夫曼测控技术有限公司 | 信阳市建筑勘察设计研究院有限公司| 定制奶茶纸杯_定制豆浆杯_广东纸杯厂_[绿保佳]一家专业生产纸杯碗的厂家 | 佛山市德信昌电子有限公司| 智能汉显全自动量热仪_微机全自动胶质层指数测定仪-鹤壁市科达仪器仪表有限公司 | 阿里巴巴诚信通温州、台州、宁波、嘉兴授权渠道商-浙江联欣科技提供阿里会员办理 | 全自动过滤器_反冲洗过滤器_自清洗过滤器_量子除垢环_量子环除垢_量子除垢 - 安士睿(北京)过滤设备有限公司 | TYPE-C厂家|TYPE-C接口|TYPE-C防水母座|TYPE-C贴片-深圳步步精 | 不锈钢水箱生产厂家_消防水箱生产厂家-河南联固供水设备有限公司 |