Recently bought a new Windows notebook, installed the Ubuntu system, then the tragedy happened.
Install MySQL with the command, the default is 5.7 (the low version cannot be installed with the command), and then the Mysql-u root-p (then enter the password) can not connect, sudo mysql-u root-p (and then enter the password, in fact, enter any password is right) to connect. The result is that the management tool (Workbench) is not connected to the project. Baidu for 1 days, finally met a buddy with my phenomenon, and then seriously said reinstall MySQL, not add sudo can also connect, I have reinstalled n times, has not been. Even suspect is a system problem, ready to reinstall Ubuntu16, fortunately online saw a buddy said 16 default installation is also 5.7. Then fell into a meditation ....
Continue Baidu, the sun, a friend said 5.7 after the root user added Auth_socket plug-in, the local does not allow the connection. Then use sudo to enter MySQL and query for select * from Mysql.user. Found that there are several users, see the Plugin field and authentication_string (root user password this column empty) difference, seems to understand a little (in fact, not fully understand), and suddenly think of online said with/ETC/MYSQL/DEBIAN.CNF In the user name and password, suddenly feel that debian-sys-maint is I want to find the user, of course, can also be new (before the Local has been using root), is a waste of time, also received a lesson, stand affixed as proof.
Ubuntu18 installing MySQL encountered root password problem