//安装好后,查看原始密码
sudo cat /etc/mysql/debian
//仔细看打印信息,其中有密码
mysql -u debian-sys-maint -p
//输入密码//进入mysql修改密码
use mysql;
update mysql.user set authentication_string=password('root') where user='root';
update mysql.user set authentication_string=PASSWORD('root'), plugin='mysql_native_password' where user='root';
grant all privileges on *.* to 'root'@'%' identified by 'root';
flush privileges;
exit;//之后exit退出mysql,编辑配置文件
sudo editor /etc/mysql/mysql.conf.d/mysqld.cnf
//将bind-address = 127.0.0.1注释掉(即在行首加#),如下:
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
# bind-address =127.0.0.1//重启mysql
sudo service mysql start
//进入mysql更新数据库
mysql -uroot -p
use 数据库名;
source /***/***.sql //导入数据库文件