遇到这个问题,找了好久, 仍是找到了,只是这界面看起来像是Mac电脑的:html
转自:https://www.cnblogs.com/WXGC-yang/p/10562203.htmlmysql
sudo apt-get updatesql
sudo apt-get install mysql-serverui
这种状况没什么问题,经过已下命令登陆MySQLspa
mysql -u root -p3d
这种状况能够尝试使用空密码进行登陆server
我在安装MySQL时遇到没有提示设置密码且空密码无效的状况,报错信息以下:htm
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)blog
Ubuntu在安装MySQL时会为用户建立一个debian-sys-maint用户咱们能够经过这个用户来设置get
sudo cat /etc/mysql/debian.cnf
mysql -u debian-sys-maint -p
注意:此时密码为刚刚查到的密码
如今咱们已经登陆到MySQL了
use mysql;
update mysql.user set authentication_string=password('你的密码') where user='root' and Host ='localhost';
update user set plugin="mysql_native_password";
flush privileges;
quit;
OK! 问题解决了