Removed privileges from root user and can't access database
You can use following steps to regrant root priviledge.


Shutdown mysqld.
Start mysqld with --skip-grant-tables.
Use mysql to connect mysqld. (Type mysql only, No need to input password -p, maybe No need to input username root, either)
UPDATE mysql.user SET Grant_priv='Y', Super_priv='Y' WHERE User='root';

FLUSH PRIVILEGES;
Restart  mysqld normally.