Solve the problem of root account login mysql only sudo login under Ubuntu

Insert picture description here
Solution:

sudo vim /etc/mysql/my.cnf

Add to:

[mysqld]
skip-grant-tables

Save and exit.
Then execute the following two commands to restart the mysql service:

service mysqld stop
service mysqld start

Or directly execute the command to restart the service:

service mysqld restart

After the restart, the modification of the above configuration will take effect. At this time, you do not need to add sudo to log in.

Guess you like

Origin blog.csdn.net/BigData_Mining/article/details/107318193