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