Ubuntu下普通账户只能通过sudo登陆mysql的问题
1:mysql版本Ver 8.0.28. 登陆错误,提示Access denied
maliang@DESKTOP-U3G1DNQ:/mnt/c/Users/notbu/Desktop$ mysql -u root -p
Enter password:
ERROR 1698 (28000): Access denied for user 'root'@'localhost'
2:解决方法
sudo vim /etc/mysql/my.cnf
添加:
[mysqld]
skip-grant-tables
保存退出,并重启mysql
service mysql restart