mysql客户端命令mysqladmin介绍
1.mysql
help:查看客户端命令的帮助(\h \?)
\G:使用key:value的形式展示数据
tee:记录日志(\T)
mysql> tee /tmp/a.log
mysql> \T /tmp/a.log
\c:结束一条不想执行的命令 (ctrl +c)
\q:quit exit 退出mysql
status:\s查看MySQL的详细信息
\.:source 导入数据
mysql> source /tmp/test123.sql
mysql> \. /tmp/test123.sql
[root@db01 ~]# mysql -uroot -p123 < /tmp/test123.sql
use:\u 切换数据库
mysql> use mysql
Database changed
mysql> \u test
Database changed
mysql> select database();
+------------+
| database() |
+------------+
| mysql |
+------------+
system:(\!)不退出数据库的情况下,使用系统命令
mysql> \! ls -l /
2.mysqladmin
#1.查看MySQL内置的参数
[root@db01 ~]# mysqladmin variables
#2.改密码(设置密码)
[root@db01 ~]# mysqladmin password '123'
[root@db01 ~]# mysqladmin -uroot -p123 password '1'
#3.监测MySQL是否存活
[root@db01 ~]# mysqladmin ping
#4.关闭MySQL进程
[root@db01 ~]# mysqladmin -uroot -p123 shutdown
#5.查看MySQL状态
[root@db01 ~]# mysqladmin -uroot -p123 status
#6.创建数据库
[root@db01 ~]# mysqladmin -uroot -p123 create test111
#7.删除数据库
[root@db01 ~]# mysqladmin -uroot -p123 drop test111
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 'test111' database [y/N] y
Database "test111" dropped
#8.刷新binlog
[root@db01 ~]# mysqladmin flush-log
#9.重新加载授权表,刷新缓存主机
[root@db01 ~]# mysqladmin reload