

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
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
What are the minimum MySQL user privileges to allow 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)
- Related Questions & Answers
- How to create MySQL user with limited privileges?
- How can we grant privileges to a MySQL user?
- How can I restore the MySQL root user full privileges?
- Grant all privileges of a database to a MySQL user?
- How can we revoke privileges from a MySQL user?
- MySQL new user access denied even after giving privileges?
- Check privileges (grants) for a specific user in MySQL?
- What are the privileges required to use triggers?
- What are the properties of MySQL user variables?
- How to allow a MySQL user account to connect from any host?
- What are the different privileges required for using views?
- How to repair MySQL tables from the command line?
- Which tables are used to control the privileges of MySQL database server?
- What are Credit card Frauds and characteristics that allow fraud?
- What is the use of FLUSH PRIVILEGES statement in MySQL?
Advertisements