exploit
1/29/2019 - 7:26 AM

mysql

create database `flasky` default character set utf8 collate utf8_general_ci;
docker run --name mysql -p 3306:3306 -v /data/mysql:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=123456 -d mysql:5.7
docker exec -it /bin/bash
repo: http://repo.mysql.com/
$ wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
$ yum localinstall mysql57-community-release-el7-11.noarch.rpm
$ yum install mysql-community-server
mysql -u root
mysql > use mysql;
mysql > update user set password=password('qwer1234') where user='root';
FLUSH PRIVILEGES;
mysql > exit;
1、修改 /etc/my.cnf,在 [mysqld] 小节下添加一行:skip-grant-tables=1

这一行配置让 mysqld 启动时不对密码进行验证

2、重启 mysqld 服务:systemctl restart mysqld

3、使用 root 用户登录到 mysql:mysql -u root 

4、切换到mysql数据库,更新 user 表:

update user set authentication_string = password('wzw011992'), password_expired = 'N', password_last_changed = now() where user = 'wluser';

在之前的版本中,密码字段的字段名是 password,5.7版本改为了 authentication_string

5、退出 mysql,编辑 /etc/my.cnf 文件,删除 skip-grant-tables=1 的内容

6、重启 mysqld 服务,再用新密码登录即可
grant all privileges on *.* to '%'@'%' identified by 'qwe123' with grant option

flush privileges;

service mysqld restart
use awesome;
grant select,insert,update,delete on awesome.* to 'john(user)'@'localhost' identified by 'qwe123(password)';
flush privileges;
vim /etc/mysql/my.cnf
bind-address :0.0.0.0
mysql -h 127.0.0.1 -u root -p