sudocat /etc/mysql/debian.cnf # user: xxx password: xxxxxx
mysql -u xxx -p # password: xxxxxx
use mysql;
ALTER USER'root'@'localhost' IDENTIFIED WITH caching_sha2_password BY '123456';
mysql -u root -p # password: 123456
设置远程访问
use mysql;# create user 'root'@'%' identified by '123456';
update user sethost='%' where user='root';
flush privileges;# For linux.sudo gedit /etc/mysql/mysql.conf.d/mysqld.cnf
注释掉第31行
sudo systemctl restart mysql.service