
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Minimum MySQL User Privileges for Optimize and Repair
The select and insert statements are the minimum required MySQL user privileges to allow optimize and repair.
You can use below syntax to give insert and select privileges to the user −
grant insert,select on yourDatabaseName.* to 'yourUserName'@'localhost';
At first, here is the query to create a user −
mysql> create user 'Emma'@'localhost' identified by 'Emma123'; Query OK, 0 rows affected (0.26 sec)
Here is the query to give grants for the above user −
mysql> grant insert,select on web.* to 'Emma'@'localhost'; Query OK, 0 rows affected (0.21 sec)
Here is the query to display all grants of the above user −
mysql> show grants for 'Emma'@'localhost';
This will produce the following output −
+-------------------------------------------------------+ | Grants for Emma@localhost | +-------------------------------------------------------+ | GRANT USAGE ON *.* TO `Emma`@`localhost` | | GRANT SELECT, INSERT ON `web`.* TO `Emma`@`localhost` | +-------------------------------------------------------+ 2 rows in set (0.00 sec)
Advertisements