MySQL Configuration
3 min
Purpose
In MySQL, the objective is to create a user that can connect and perform SELECT operations on any database/table without modification rights.
Grant Permissions
-- Connection - only privilege
GRANT USAGE ON *.* TO ’[ username ]’@’%’;
-- Grant read access to all tables
GRANT SELECT ON *.* TO ’[ username ]’@’%’;
-- Apply privileges
FLUSH PRIVILEGES ;Testing Permissions
Connect as [username] and execute a SELECT query:
USE testdb ;
SELECT * FROM test_table ;If [username] can retrieve the data without an error, the privileges are correctly granted.