MySQL is an open-source database management system for storing, organising, and retrieving data. It includes a number of options for granting individual users access within tables and databases.
On our server management plan, our experts will cover MySQL setup, optimisation and database migrations.
Create User in MySQL
Login to MySQL server with below command
mysql -u root -p
Enter Password:
Now, create the user
CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';
At this time, newuser does not have any access to the databases. In fact, newuser will be unable to access the MySQL shell even if they try to login (using the password, given). As a result, the first step is to give the user access to the information they’ll need.
GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'localhost';
The asterisks in this command denote the database and table that they can access, respectively. The user can read, edit, execute, and conduct all tasks across all databases and tables using this command.
Always remember to reload all privileges after you’ve confirmed the permissions you wish to set up for your new users.
FLUSH PRIVILEGES;
Run the following commands to check a user’s current permissions
SHOW GRANTS FOR 'username'@'localhost';
If you need any assistance in setting up MySQL user and Database on your server, our technical experts are available anytime to help you.