I have MyCloudMirror NAS box and I accidentally delete root user from MySQL now I can’t login to mysql.
I have uninstall and reinstall the phpmyadmin app but that did not make any different
I also try following but nothing is working
mysqld_safe --skip-grant-tables &
below command show that all permission are assign
CREATE USER 'root'@'localhost' IDENTIFIED BY '';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION;
this doesnt assign all permission the trigger are uncheck
CREATE USER 'root'@'%' IDENTIFIED BY '';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;
If I try to check triger from myphpadmin and click on apply i get error message
GRANT ALL PRIVILEGES ON . TO ‘root’@’%’ REQUIRE NONE WITH GRANT
OPTION MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0
MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0; MySQL said:
Documentation#1045 – Access denied for user ‘root’@’localhost’ (using password: NO)
2
Answers
This is how I fixed the issue
Run /usr/bin/mysql_reset.py --reset
The above command reset all settings on DB
GRANT ALL PRIVILEGES
is not enough.On MySQL 8+ you must execute the next statements: