ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root的密碼'; FLUSH PRIVILEGES;
若上述語法不行(5.5.5-10.4.30-MariaDB),請試試下面語法:
ALTER USER 'root'@'localhost' IDENTIFIED BY 'root新密碼'; FLUSH PRIVILEGES;
若還不行(5.5.68-MariaDB),用這個
use mysql; UPDATE mysql.user SET Password=PASSWORD('root新密碼') WHERE User='root'; UPDATE user set plugin='' where User='root'; FLUSH PRIVILEGES;
進階搜尋