sudo mysql -u$1 -p$2<<EOF use mysql; update mysql.user set authentication_string=password('123456') where user='root' and host='localhost'; update user set plugin="mysql_native_password"; flush privileges; create database spider; use spider; source /home/sunh/spider/spider.sql; use mysql; update user set host = '%' where user = 'root'; flush privileges; EOF
sudo sed -i 's/bind-address/#bind-address/g' /etc/mysql/mysql.conf.d/mysqld.cnf systemctl restart mysql ip addr