渗透之SQL注入-MYSQL常用语法

数据库基本操作
1、连接数据库
    mysql -u root -p
    mysql -H 192.168.***.*** -P 3306 -u root -p root
        #远程登录数据库(需设置相关权限)
2、设置权限
    grant all privileges on *.* to 'root'@'localhost'
    identified by 'root' with grant option;
        #all privileges  所有权限,可替换为select 或 update
        #*.* 数据库名.表名 
        #'root'@'localhost' 前边表示用户名,@后边表示连接限制的主机,可以是IP、IP端、域名、%(任何地方)
        #identified by 指定用户的登录密码
        #with grant option 可以将权限授权给其他


3、设置密码
    mysql -u root -P
    use mysql
    update user set Password=PASSWORD('root') where User='root'
    flush privileges
    #或退出数据库后重启mysql   service mysql restart
4、设置权限
    GRANT ALL PRIVILEGES ON *.* TO 'root'

你可能感兴趣的:(渗透测试,mysql,数据库,web安全)