附录C: MySQL常用命令
系统命令
mysqladmin start /ect/init.d/mysql startmysqladmin restart /ect/init.d/mysql restartmysqladmin shutdown /ect/init.d/mysql shutdownmysqladmin -u用户名 -p旧密码 password 新密码set password for root=password("root");grant select on 数据库.* to 用户名@登录主机 identified by "密码";grant select,insert,update,delete on *.* to test@"% " identified by "123";flush privilegesshow enginesshow variables like '%storage_engine%';select version();show variables like '%max_connections%’; #查看最大连接数设置 set global max_connections = 200; #设置最大连接数 select * from information_schema.processlist where db=''; #查看进程/连接列表,可指定数据库。和show processlist一样show engine innodb status; #LATEST DETECTED DEADLOCK这一栏即死锁信息show variables like '%slow%’; //查看慢查询日志配置 set global slow_query_log='ON'; //开启慢查询 set global long_query_time=4;//这只慢查询语句的耗时阈值[select query] into outfile '[filePath]'; pager cat > [filePath]; #所有查询结果都自动写入指定文件中,并前后覆盖 mysql -h [host] -u [user] -p [password] -P [port] -e "[query]" > [filePath]
数据操作
数据的导入导出
编码操作
数据库元信息查询
数据库性能信息查询
Last updated