学习笔记之MariaDB基础操作

MariaDB

  

 mysql

        --user  -u

        --host  -h

        --password   -p

        --port 

        --protocol

        --database DATABASE -D  连接使用默认库


mariaDB 是需要语句结束符的。可以使用\d 改变

还有一些数据不需要发送到服务器端

\c可以终止一个没写完的sql语句

更多的可以使用\?查询

MariaDB的注释符/**/



也可以使用html的格式




[root@www ~]# mysql --html -u root -pEnter password: Welcome to the MariaDB monitor. Commands end with ; or \g.MariaDB [CargoWarehouse]> show tables;<TABLE BORDER=1><TR><TH>Tables_in_CargoWarehouse</TH></TR><TR><TD>customers</TD></TR><TR><TD>orderitems</TD></TR><TR><TD>orders</TD></TR><TR><TD>productnotes</TD></TR><TR><TD>products</TD></TR><TR><TD>vendors</TD></TR></TABLE>



修改密码




[root@www ~]# mysqladmin -u root -p password "123" Enter password:


创建数据库

[root@www ~]# mysqladmin -uroot -p  create mydb
Enter password: 

删除数据库

[root@www ~]# mysqladmin -uroot -p create mydbEnter password:


查看数据库是否在线

[root@www ~]# mysqladmin -u root -p -h 127.0.0.1 pingEnter password: mysqld is alive[root@www ~]#


查看MariaDB的正在执行的列表

[root@www ~]# mysqladmin -u root -p processlist;Enter password: +----+------+-----------+----+---------+------+-------+------------------+----------+| Id | User | Host | db | Command | Time | State | Info | Progress |+----+------+-----------+----+---------+------+-------+------------------+----------+| 34 | root | localhost | | Query | 0 | | show processlist | 0.000 |+----+------+-----------+----+---------+------+-------+------------------+----------+[root@www ~]#


查看MariaDB的服务器状态

[root@www ~]# mysqladmin -u root -p statusEnter password: Uptime: 1126836 Threads: 1 Questions: 371 Slow queries: 0 Opens: 34 Flush tables: 2 Open tables: 47 Queries per second avg: 0.000[root@www ~]#


也可以每1s查询一次

[root@www ~]# mysqladmin -u root -p status --sleep 1 --count 4Enter password: Uptime: 1126916 Threads: 1 Questions: 372 Slow queries: 0 Opens: 34 Flush tables: 2 Open tables: 47 Queries per second avg: 0.000Uptime: 1126917 Threads: 1 Questions: 372 Slow queries: 0 Opens: 34 Flush tables: 2 Open tables: 47 Queries per second avg: 0.000Uptime: 1126919 Threads: 1 Questions: 372 Slow queries: 0 Opens: 34 Flush tables: 2 Open tables: 47 Queries per second avg: 0.000Uptime: 1126920 Threads: 1 Questions: 372 Slow queries: 0 Opens: 34 Flush tables: 2 Open tables: 47 Queries per second avg: 0.000[root@www ~]#


查看状态变量

[root@www ~]# mysqladmin -u root -p extended-statusEnter password: +------------------------------------------+-------------+| Variable_name | Value |+------------------------------------------+-------------+| Aborted_clients | 0 || Aborted_connects | 14 || Access_denied_errors | 12 || Aria_pagecache_blocks_not_flushed | 0 || Aria_pagecache_blocks_unused | 15737 || Aria_pagecache_blocks_used | 2 || Aria_pagecache_read_requests | 53 || Aria_pagecache_reads | 7 || Aria_pagecache_write_requests | 14 || Aria_pagecache_writes | 0 |


查看服务器变量

[root@www ~]# mysqladmin -u root -p variablesEnter password:


关闭服务器

[root@www ~]# mysqladmin -u root -p shutdownEnter password:


启动复制功能

start-slave


  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值