07-20-2023, 02:44 PM
Access the database as a user administrator (root user maybe). Check the right one user privileges to the database.
mysql >SHOW GRANTS FOR <username>;
Assign full user privileges to the database from localhost
mysql> GRANT ALL PRIVILEGES ON <databasename>.* TO '<username>'@'localhost' IDENTIFIED BY '<password>';
mysql> FLUSH PRIVILEGES;
in case of error in connecting to the database from third-party programs, for example MySQL WORKBENCH, assign privileges to the user to the database from any host
MYSQL Grant all privileges to database from any host
mysql> GRANT ALL PRIVILEGES ON <databasename>.* TO '<username>'@'%' IDENTIFIED BY '<password>';
mysql> FLUSH PRIVILEGES;
mysql >SHOW GRANTS FOR <username>;
Assign full user privileges to the database from localhost
mysql> GRANT ALL PRIVILEGES ON <databasename>.* TO '<username>'@'localhost' IDENTIFIED BY '<password>';
mysql> FLUSH PRIVILEGES;
in case of error in connecting to the database from third-party programs, for example MySQL WORKBENCH, assign privileges to the user to the database from any host
MYSQL Grant all privileges to database from any host
mysql> GRANT ALL PRIVILEGES ON <databasename>.* TO '<username>'@'%' IDENTIFIED BY '<password>';
mysql> FLUSH PRIVILEGES;